[vtkusers] How to generate a surface normal glyph for a triangle cell
Elvis Dowson
elvis.dowson at mac.com
Wed Oct 8 03:02:53 EDT 2008
Hi,
I'm just trying to breakdown the problem. I'm just stuck at
one point below. Could someone help?
arrowGlyphPoints InsertNextPoint [planeSource GetNormal]
I have a plane source and I want to pass the plane normal to an arrow
glyph. I'm using vtkPoints to represent the location of the arrow
glyph. I can't seem to get the correct data type to be passed from
vtkPlanceSource::GetNormal() to vtkPoints::InsertNextPoint() in TCL. I
get the error message, Object named: arrowGlyphPoints, could not find
requested method: InsertNextPoint
or the method was called with incorrect arguments.
How can I fix the call to the above method in TCL?
Here are the method declarations.
vtkPoints::InsertPoints(const double x[3])
virtual double* vtkPlaneSource::GetNormal()
virtual void vtkPlaneSource::GetNormal(double data[3])
Question: How can I pass data[3] or double * returned by
vtkPlaneSource::GetNormal() into vtkPoints::InsertNextPoint() ?
Best regards,
Elvis Dowson
Example TCL code
# This example shows how to manually construct a plane and display its
surface normal
# using Tcl.
#
package require vtk
package require vtkinteraction
# Create a plane source
vtkPlaneSource planeSource
vtkDataSetMapper planeMapper
planeMapper SetInput [planeSource GetOutput]
vtkActor planeActor
planeActor SetMapper planeMapper
# Create an arrow glyph to represent the surface normal
# -----------------------------------------------------
# Specify the location of the glyph
vtkPolyData arrowGlyphPolyData
vtkPoints arrowGlyphPoints
arrowGlyphPolyData SetPoints arrowGlyphPoints
#arrowGlyphPoints InsertNextPoint 1 1 0
arrowGlyphPoints InsertNextPoint [planeSource GetNormal]
# Specify the shape of the glyph
vtkArrowSource arrowSource
vtkGlyph3D arrowGlyph
arrowGlyph SetSource [arrowSource GetOutput]
arrowGlyph SetInput arrowGlyphPolyData
vtkDataSetMapper arrowGlyphMapper
arrowGlyphMapper SetInputConnection [arrowGlyph GetOutputPort]
vtkActor glyphActor
glyphActor SetMapper arrowGlyphMapper
# Create the usual rendering stuff.
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
renWin SetSize 300 150
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
#ren1 SetBackground .1 .2 .4
ren1 AddActor planeActor
ren1 AddActor glyphActor
ren1 ResetCamera
ren1 ResetCameraClippingRange
renWin Render
# render the image
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize
wm withdraw .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081008/90a33ddb/attachment.htm>
More information about the vtkusers
mailing list