[vtkusers] changing the positions of points

Toh Da Jun tohdj at bii.a-star.edu.sg
Wed Jan 12 22:55:46 EST 2005


I created 8 points...and rendered them on screen. Even though i changed
the position of one of the points, it does not get updated on the
screen. I tried re-rendering the vtkRenderer ren1, and vtkRenderWindow
renWin, but it still does not get updated.

Any idea where i went wrong?


tohdj






vtkPoints polyVertexPoints
  polyVertexPoints SetNumberOfPoints 8
  polyVertexPoints InsertPoint 0 0 0 0
  polyVertexPoints InsertPoint 1 1 0 0
  polyVertexPoints InsertPoint 2 1 1 0
  polyVertexPoints InsertPoint 3 1 0 1
  polyVertexPoints InsertPoint 4 0 1 1
  polyVertexPoints InsertPoint 5 0 0 1
  polyVertexPoints InsertPoint 6 0 1 0
  polyVertexPoints InsertPoint 7 1 1 1
vtkPolyVertex aPolyVertex
  [aPolyVertex GetPointIds] SetNumberOfIds 8
  [aPolyVertex GetPointIds] SetId 0 0
  [aPolyVertex GetPointIds] SetId 1 1
  [aPolyVertex GetPointIds] SetId 2 2
  [aPolyVertex GetPointIds] SetId 3 3
  [aPolyVertex GetPointIds] SetId 4 4
  [aPolyVertex GetPointIds] SetId 5 5
  [aPolyVertex GetPointIds] SetId 6 6
  [aPolyVertex GetPointIds] SetId 7 7
vtkUnstructuredGrid aPolyVertexGrid
  aPolyVertexGrid Allocate 1 1
  aPolyVertexGrid InsertNextCell [aPolyVertex GetCellType] [aPolyVertex
GetPointIds]
  aPolyVertexGrid SetPoints polyVertexPoints
vtkDataSetMapper aPolyVertexMapper
  aPolyVertexMapper SetInput aPolyVertexGrid
vtkActor aPolyVertexActor
  aPolyVertexActor SetMapper aPolyVertexMapper
  aPolyVertexActor AddPosition 0 0 0
 [aPolyVertexActor GetProperty] SetDiffuseColor 1 1 1


# Create the usual rendering stuff.
vtkRenderer ren1
vtkRenderWindow renWin
  renWin AddRenderer ren1
#  renWin PrefFullScreen
  renWin SetSize 500 500
vtkRenderWindowInteractor iren
  iren SetRenderWindow renWin

ren1 SetBackground .0 .0 .0

ren1 AddActor aPolyLineActor
ren1 AddActor aPolyVertexActor

[ren1 GetActiveCamera] Azimuth 30
[ren1 GetActiveCamera] Elevation 20
[ren1 GetActiveCamera] Dolly 2.8
ren1 ResetCameraClippingRange

renWin Render

polyVertexPoints SetPoint 7 2 2 2   # Change the position of pointID #7

renWin Render

# render the image
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize


# Reset the view to zoom all in
ren1 ResetCamera
iren Render





More information about the vtkusers mailing list