[vtkusers] vtkCubeSource issues

Jorge Ballesteros jballesteros at motivando.me
Sun Jun 20 15:24:08 EDT 2010


Hi David,

I supposed it was an obvious and old question but i was looking on the 
vtkusers list and didn't find anything. I had already used the 
vtkCleanPolyData class to remove this points. Actually I was looking for 
the reason why this points where there. Anyway, thank you very much for 
your explanation.

Any hint on the connectivity issue. How are the connections between 
points generated?

Thanks again,

Jorge

On 06/20/2010 01:24 PM, David Doria wrote:
> On Sun, Jun 20, 2010 at 8:18 AM, Jorge Ballesteros
> <jballesteros at motivando.me>  wrote:
>    
>> 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.
>>
>>
>>
>>
>>      
> I was wondering about this not too long ago. Bill clarified that "the
> points are repeated so that the point normals for each face are normal
> to each face. You can't do that with shared vertices."
>
> I think that if you run vtkCleanPolyData on the output of the source,
> it will produce the non-repeated point geometry that you are looking
> for.
>
> Thanks,
>
> David
>    




More information about the vtkusers mailing list