[vtkusers] vtkCubeSource Issues

Jorge Ballesteros jballesteros at motivando.me
Sun Jun 20 08:17:10 EDT 2010


Hello all,

I have been playing with some of the vtk source classes 
(vtkSphereSource, vtkCubeSource, etc..) for generating simple meshes. I 
have noticed some issues when i use the vtkCubeSource.

Let's focus on this example:

http://www.vtk.org/Wiki/VTK/Examples/GeometricObjects/Cube

The output file cube.vtp, contains 24 points, not 8. Every point is 
repeated 3 times. Is that ok?

"cube.vtp"
...
<DataArray type="Float32" Name="Points" NumberOfComponents="3" 
format="ascii" RangeMin="0.43301270189" RangeMax="0.43301270189">
-0.25 -0.25 -0.25 -0.25 -0.25 0.25
-0.25 0.25 -0.25 -0.25 0.25 0.25
0.25 -0.25 -0.25 0.25 -0.25 0.25
0.25 0.25 -0.25 0.25 0.25 0.25
-0.25 -0.25 -0.25 -0.25 -0.25 0.25
0.25 -0.25 -0.25 0.25 -0.25 0.25
-0.25 0.25 -0.25 -0.25 0.25 0.25
0.25 0.25 -0.25 0.25 0.25 0.25
-0.25 -0.25 -0.25 0.25 -0.25 -0.25
-0.25 0.25 -0.25 0.25 0.25 -0.25
-0.25 -0.25 0.25 0.25 -0.25 0.25
-0.25 0.25 0.25 0.25 0.25 0.25
</DataArray>
...

With this output file i generate an unstructured grid, applying 
vtkDelaunay3d class.

#######
vtkSmartPointer<vtkDelaunay3D> del = vtkSmartPointer<vtkDelaunay3D>::New();
del->SetInput(cubeSource->GetOutput());
del->Update();

vtkSmartPointer<vtkXMLUnstructuredGridWriter> gridWriter = 
vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
gridWriter->SetInputConnection(del->GetOutputPort());
gridWriter->SetDataModeToAscii();
gridWriter->SetFileName("cube.vtu");
gridWriter->Write();
#######

Whenever i try to look deeper in to the resulting mesh ("cube.vtu"), i 
have noticed that not every point of the resulting mesh is interconnected.

"cube.vtu"
...
<DataArray type="Int32" Name="connectivity" format="ascii" RangeMin="0" 
RangeMax="7">
2 1 0 4 3 1
2 4 4 3 1 5
3 4 2 6 5 4
3 6 5 6 3 7
</DataArray>
...

I mean, iterating through the grid, using grid->GetPointCells() method, 
points with id:

* 0, 7: only 1 cell.
* 1, 2, 5, 6: 3 cells.
* 3, 4: 5 cells.
* [8-23]: 0 cells. No connectivity.

Some questions arises:

- Why there are 16 isolated points [8-23]?
- Why points [0-7] do not have the same connectivity?

Hope someone could help me on this!

Thanks in advance,

Jorge.







More information about the vtkusers mailing list