[vtkusers] (no subject) - Arrows
Simon J. Rees
sjrees at okstate.edu
Thu Apr 19 14:38:07 EDT 2001
If you don't want just the line produced by vtkHedgeHog and want a complete arrow you can join a cylinder and cone using vtkAppendPolyData before putting it through vktGlyph3D. You can change the appearance (lines vs surfaces) by adjusting the parameters of the cone and cylinder and setting the representation to wireframe or surface. Setting the cone resolution to 2 just gives two orthogonal triangles that are useful for a simple arrow head. For example:
vtkCylinderSource cyl
#cyl SetResolution 10 ;# for complex arrows
cyl SetResolution 1
cyl SetRadius .02
cyl SetHeight 2
vtkTransform cylTrans
cylTrans Identity
cylTrans RotateZ 90
cylTrans Translate 0 -1.0 0
vtkTransformPolyDataFilter cylTransFilter
cylTransFilter SetInput [cyl GetOutput ]
cylTransFilter SetTransform cylTrans
vtkConeSource cone
#cone SetResolution 10 ;# for complex arrows
cone SetResolution 2
vtkTransform coneTrans
coneTrans Identity
coneTrans Translate 2.5 0 0
vtkTransformPolyDataFilter coneTransFilter
coneTransFilter SetInput [cone GetOutput ]
coneTransFilter SetTransform coneTrans
vtkAppendPolyData arrow
arrow AddInput [cylTransFilter GetOutput ]
arrow AddInput [coneTransFilter GetOutput]
arrow Update
vtkGlyph3D arrows
arrows SetInput [reader GetOutput]
arrows SetSource [arrow GetOutput]
arrows SetScaleFactor $vscale
arrows SetScaleModeToScaleByVector
vtkLookupTable lut
lut SetHueRange .667 0.0
lut Build
vtkPolyDataMapper vecMapper
vecMapper SetInput [arrows GetOutput]
vecMapper SetScalarRange $minv $maxv
vecMapper SetLookupTable lut
vtkActor vecActor
vecActor SetMapper vecMapper
# for simple arrows
[vecActor GetProperty] SetRepresentationToWireframe
[vecActor GetProperty] SetAmbient 1
[vecActor GetProperty] SetDiffuse 0
[vecActor GetProperty] SetSpecular 0
# for complex arrows
# [vecActor GetProperty] SetRepresentationToSurface
# [vecActor GetProperty] SetAmbient 0
# [vecActor GetProperty] SetDiffuse 1
# [vecActor GetProperty] SetSpecular 0
I find that ambient lighting is better for the simple type of arrows. Hope this helps
-sjr
----- Original Message -----
From: Simon Bulman
To: vtkusers at public.kitware.com
Sent: Thursday, April 19, 2001 4:07 AM
Subject: [vtkusers] (no subject)
Hi All,
I want to display vector orientation and magnitude using arrows.
Is there a way to do this. I looked at the vtkHedgeHog class but this seems to draw lines
only (no arrow tip). The vtkGlmph2D has an arrow but is of course only for 2D where as my
data is 3D. The vtkGlmph3D can be used with a cone (for example) but I tried this a it looks
messy to me (unless you use a high resolution for the cone, but this gets slow!)
Any ideas??
Thanks
Simon
================================
S.D.Bulman.
Senior Research Officer.
University of Wales Swansea.
S.D.Bulman at swansea.ac.uk
(W) +44 (0)1792 513179
(H) +44 (0)1792 511144
================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010419/4ef13d54/attachment.htm>
More information about the vtkusers
mailing list