making a 3d arrow

Goodwin Lawlor goodwin.lawlor at ucd.ie
Tue Aug 10 09:44:27 EDT 1999



-----Original Message-----
From:	Tomasz Lukasiak [SMTP:tcl at lems25.lems.brown.edu]
Sent:	Monday, August 09, 1999 9:19 PM
To:	vtkusers at gsao.gso.med.ge.com
Subject:	making a 3d arrow

 << File: ATT00000.html >> Hi,

    I am combining 2 polydata sets (a cone and a cylinder) to create a 3D 
arrow.

My problem is that I'm not sure how to rotate the cone data so that it sits 
on

one end of the cylinder.  What facilities are there to transform polydata?

Thanks,

Tom


Tom,

Below is a modified version of the tcl script 
vtk/graphics/examplesTcl/thrshldV.tcl that seems to be what you want (it 
renders 3d arrows). The "arrow geometry" section contains the transform you 
need to do to get the arrow correctly formed. You need the "carotid.vtk" 
data file to run the script below.
Hope it helps,

Goodwin



catch {load vtktcl}
# create selected arrows
# get the interactor ui
source ../../examplesTcl/vtkInt.tcl
source ../../examplesTcl/colors.tcl

vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
# create pipeline
#
vtkStructuredPointsReader reader
reader SetFileName "../../../vtkdata/carotid.vtk"
vtkThresholdPoints threshold
threshold SetInput [reader GetOutput]
threshold ThresholdByUpper 200
vtkMaskPoints mask
mask SetInput [threshold GetOutput]
mask SetOnRatio 10
# the arrow geometry
vtkCylinderSource cyl
cyl SetResolution 10
cyl SetRadius .2
cyl SetHeight 2

vtkTransform cylTrans
cylTrans Identity
cylTrans RotateZ  90
cylTrans Translate  0 1.5 0

vtkTransformPolyDataFilter cylTransFilter
cylTransFilter SetInput [cyl GetOutput ]
cylTransFilter SetTransform cylTrans
vtkConeSource cone
cone SetResolution 10

vtkAppendPolyData arrow
arrow AddInput [cylTransFilter GetOutput ]
arrow AddInput [cone GetOutput]
arrow Update
vtkGlyph3D arrows
arrows SetInput [mask GetOutput]
arrows SetSource [arrow GetOutput]
arrows SetScaleFactor 0.2
arrows SetScaleModeToScaleByVector
vtkLookupTable lut
lut SetHueRange .667 0.0
lut Build
vtkPolyDataMapper vecMapper
vecMapper SetInput [arrows GetOutput]
vecMapper SetScalarRange 2 10
vecMapper SetLookupTable lut
vtkActor vecActor
vecActor SetMapper vecMapper
# contours of speed
vtkContourFilter iso
iso SetInput [reader GetOutput]
iso SetValue 0 190
vtkPolyDataMapper isoMapper
isoMapper SetInput [iso GetOutput]
isoMapper ScalarVisibilityOff
vtkActor isoActor
isoActor SetMapper isoMapper
[isoActor GetProperty] SetRepresentationToWireframe
[isoActor GetProperty] SetOpacity 0.25
# outline
vtkOutlineFilter outline
outline SetInput [reader GetOutput]
vtkPolyDataMapper outlineMapper
outlineMapper SetInput [outline GetOutput]
vtkActor outlineActor
outlineActor SetMapper outlineMapper
set outlineProp [outlineActor GetProperty]
eval $outlineProp SetColor 0 0 0
# Add the actors to the renderer, set the background and size
#
ren1 AddActor outlineActor
ren1 AddActor vecActor
ren1 AddActor isoActor
ren1 SetBackground 1 1 1
renWin SetSize 500 500
#renWin SetSize 1000 1000
ren1 SetBackground 0.1 0.2 0.4
[ren1 GetActiveCamera] Zoom 1.5
iren Initialize

# render the image
#
iren SetUserMethod {wm deiconify .vtkInteract}
#renWin SetFileName "thrshldV.tcl.ppm"
#renWin SaveImageAsPPM
# prevent the tk window from showing up then start the event loop
wm withdraw .





-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list