[vtkusers] Vectors

Randy Heiland heiland at ncsa.uiuc.edu
Thu Jul 27 08:03:59 EDT 2000


On Jul 27, 12:16pm, Luis Sainz Hermoso wrote:
> Subject: [vtkusers] Vectors
> Hi everybody!
> 	I'm a newbie in vtk and I'm trying to set attributes(vectors) to
> thge points of a polydata but I can't do it.I've tried usinf vtkPointData
> but I haven't got any results.
> 	Can anybody help me?
>
> 	Thank you very much
>
> 		Luis
>
> P.S. I'm using Tcl

Luis,

Including an example is always a good idea.

The following should work:
  [pd GetPointData] SetVectors vecs

as in:

catch {load vtktcl}
if { [catch {set VTK_TCL $env(VTK_TCL)}] != 0} { set VTK_TCL
"../../examplesTcl" }
if { [catch {set VTK_DATA $env(VTK_DATA)}] != 0} { set VTK_DATA
"../../../vtkdata" }

source $VTK_TCL/vtkInt.tcl

vtkRenderer ren
vtkRenderWindow renWin
renWin AddRenderer ren
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin

vtkPoints pts

set npts 3

pts InsertPoint 0 0 0 0
pts InsertPoint 1 3 1 0
pts InsertPoint 2 6 4 0

vtkCellArray ca
ca InsertNextCell 3
ca InsertCellPoint 0
ca InsertCellPoint 1
ca InsertCellPoint 2

vtkPolyData pd
pd SetPoints pts
pd SetLines ca

vtkVectors vecs
vecs InsertVector 0 0 -1 0
vecs InsertVector 1 0 -1 0
vecs InsertVector 2 0 -1 0

[pd GetPointData] SetVectors vecs

vtkPolyDataMapper pdMap
pdMap SetInput pd

vtkHedgeHog hog
hog SetInput pd

vtkDataSetMapper hogMap
hogMap SetInput [hog GetOutput]

vtkActor lineActor
lineActor SetMapper pdMap
vtkActor hogActor
hogActor SetMapper hogMap

ren AddActor lineActor
ren AddActor hogActor

renWin Render
wm withdraw .






More information about the vtkusers mailing list