[vtkusers] trying to understand vtkConvexPointSet

jelle jelleferinga at gmail.com
Tue Jul 10 10:48:05 EDT 2007


Hi, 

I'm working on displaying a set of voronoi cells in VTK.
The output of my voronoi function is a set of (inherently convex) points, so I
reckon vtkConvexPointSet is the way to go here. 
#I'm working with Tvtk, so part of my problem is translating concepts that are
#nicely wrapped by Tvtk, to the 'standard' VTK way of doing so. 
While reading the example code of vtkConvexPointSet, I did not understood the
following. 13 points are inserted in 'points', than Id's are set in
vtkConvexPointSet's underlying vtkIdList. What is mystery to me though is when
vtkConvexPointSet is called to produce its output? I wasn't able to make this
out from the docs I'm afraid. vtkConvexPointSet seems less consistent to me,
since it breaks the GetOutput idiom, but more likely than not, I'm not using
vtkConvexPointSet correctly.

What I'm looking for is to get a vtkPolyData object out of a vtkConvexPointSet.
I need to repeat this for ~200 or so voronoi cells. Any hints to do so
efficiently would be much appreciated.

Thanks!

-jelle

---------------------------------------
from TestConvexPointSet.tcl
---------------------------------------
vtkPoints points
vtkConvexPointSet aConvex
points InsertPoint 0 0 0 0
points InsertPoint 1 1 0 0
points InsertPoint 2 1 1 0
points InsertPoint 3 0 1 0
points InsertPoint 4 0 0 1
points InsertPoint 5 1 0 1
points InsertPoint 6 1 1 1
points InsertPoint 7 0 1 1
points InsertPoint 8 0.5 0 0
points InsertPoint 9 1 0.5 0
points InsertPoint 10 0.5 1 0
points InsertPoint 11 0 0.5 0
points InsertPoint 12 0.5 0.5 0
for {set i 0} {$i<13} {incr i 1} {
    [aConvex GetPointIds] InsertId $i $i
}

vtkUnstructuredGrid aConvexGrid
  aConvexGrid Allocate 1 1
  aConvexGrid InsertNextCell [aConvex GetCellType] [aConvex GetPointIds]
  aConvexGrid SetPoints points
---------------------------------------




More information about the vtkusers mailing list