[vtkusers] Changing vtkPolyData

Miller, James V (Research) millerjv at crd.ge.com
Thu May 30 11:52:16 EDT 2002


The cells in the PolyData index into the Points array. So any
changes to a point's position implicitly affects any cell that 
uses that point.

To modify a single point position (say point id 27), just do

pts SetPoint 27 $newx $newy $newz

Any cells that used point id 27 will change automatically.

Note, that I don't think SetPoint calls Modified() (in case you are modifying many
points, we don't don't want to call Modified() unnecessarily) so you probably need
to do a 

pts SetPoint 27 $newx $newy $newz
pts Modified

and you may have to tell the PolyData itself it was Modified

pts SetPoint 27 $newx $newy $newz
pts Modified
myLines Modified




-----Original Message-----
From: "Siebert, Frank-Andre" [mailto:siebert at onco.uni-kiel.de]
Sent: Thursday, May 30, 2002 10:45 AM
To: 'vtkusers at public.kitware.com'
Subject: [vtkusers] Changing vtkPolyData


Dear VTK-list members,


I have trouble with changing a vtkPolyData set. Of course I read the
list-archives and this topic was discussed before but I didn't found a 
convenient solution.

In my Application (vtk4.0 with Tcl/Tk on Win2000) I define up to 100
user given lines in a 2D image (vtkTkImageViewerWidget) by mouseclick 
as vtkPolyData. This works fine. But now I am looking for a possibility to 
change the coordinates of one single point in the vtkPolyData set.

When I look at vtkTransformPolyDataFilter it seems to me that one can
use this filter to transform the whole dataset but not a single point.




The mentioned lines in my program are defined as followed:



...
vtkPoints pts1

vtkCellArray line1

vtkPolyData myLines
    myLines SetPoints pts1
    myLines SetLines line1



# define a new line:  lineNum is the number of the line (0..99)


pts1 InsertPoint [expr 2*$lineNum] $x1 $y1 0
pts1 InsertPoint [expr 2*$lineNum +1] $x2 $y2 0
line1 InsertNextCell 2
line1 InsertCellPoint [expr 2*$lineNum]
line1 InsertCellPoint [expr 2*$lineNum+1]

viewer Render
...




It would be very helpful if somebody could give a hint how to alter the
vtkPolyData structure or could name a link to an example. 

Maybe the solution is so easy I could not see it !?



Thank you

Frank-Andre


---------------------------------------- 
Frank-Andre Siebert (PhD) 
Klinik fur Strahlentherapie 
Universitats-Klinikum Kiel (UKK) 
Arnold-Heller-Str. 9 
24105 Kiel 
Germany 
---------------------------------------- 
Email: siebert at onco.uni-kiel.de 
Tel: 0431/597-3022 
Fax: 0431/597-3110 

_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers



More information about the vtkusers mailing list