[vtkusers] Polygon problem
D. Vercauteren
dv at mindless.com
Wed Dec 27 07:56:39 EST 2000
Hi VTK'ers.
I'm using vtktcl 3.1.2 rev 1.675 (I've also tried 3.2 but it doesn't resolve my problem)
When I create a polygon, everything works fine if the polygon has a maximum of 60 points. If it has more than 60 points, a line between point 1 and point 60 is created !
The strangest thing is that the polydata has only 1 cell (polygon type) and the correct number of points and no line ! The points ids of the polygon are correct too.
Any ideas ?
Here is my code:
Draw(point_cpt) counts the number of points from 1 to n
xcoords and ycoords are lists of points coordinates (1 to n)
vtkPolyData polydata
vtkPoints points
vtkPolygon polygon
points SetNumberOfPoints $Draw(point_cpt)
#***Adding points and ids***
for {set i 0} {$i < $Draw(point_cpt)} {incr i} {
points InsertPoint $i $xcoords([expr $i + 1]) $ycoords([expr $i + 1]) 0
}
[polygon GetPointIds] SetNumberOfIds [expr $Draw(point_cpt) + 1]
for {set i 0} {$i < $Draw(point_cpt)} {incr i} {
[polygon GetPointIds] SetId $i $i
}
#to close the polygon the last point is set as the first point. I'm not sure this is useful but with or without
# this line it bugs anyway. That's why I set the number of ids to $Draw(points_cpt) + 1
[polygon GetPointIds] SetId $Draw(point_cpt) 0
#***Create the polygon in the polydata***
polydata Allocate 1 1
polydata InsertNextCell [polygon GetCellType] [polygon GetPointIds]
polydata SetPoints points
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20001227/731f1ed8/attachment.htm>
More information about the vtkusers
mailing list