[vtkusers] surface with vector

Prashanth prashanth.dumpuri at vanderbilt.edu
Thu Oct 7 10:37:52 EDT 2004


Longfei Cong,
  I'm a newbie. There might be better ways to do what you wanna do, but
this works for me.Here'a a sample tcl script.
----------------------------------
# this reads in your polydata
vtkPolyData reader
  reader SetFileName <your poly_data>
# this generates the normals
vtkPolyDataNormals normals
  normals SetInput [reader GetOutput]
  normals FlipNormalsOff
  normals SplittingOff
  normals Update
# i'm using normals as input to the hedgehog.you can use vectors.
# look into the 'SetVectorMode' function
vtkHedgeHog hog
  hog SetInput [normals GetOutput]
  # sets the size of oriented lines.
  hog ScaleFactor <scale_factor>
  hog Update
# mapper for the polydata
vtkPolyDataMapper mapper
  mapper SetInput [reader GetOutput]
# mapper for the hedgehog
vtkPolyDataMapper hog_mapper
  hog_mapper SetInput [hog GetOutput]
  eval hog_mapper SetScalarRange [[hog GetOutput] GetScalarRange]
  hog_mapper ImmediateModeRenderingOn
# actors
vtkActor hog_actor
  hog_actor SetMapper hog_mapper
  # you can play around with the properties
  [hog_actor GetProperty] SetDiffuseColor 0 0 1
vtkActor actor
  actor SetMapper mapper
vtkRenderer ren
  ren AddActor hog_actor
  ren AddActor actor
vtkRenderWindow renwin
  renwin AddRenderer ren
vtkRenderWindowInteractor iren
  iren SetRenderWindow renwin
  iren Initialize
  iren AddObserver UserEvent {wm deiconify .vtkInteract}

  renwin Render
------------------------------------------------------------------------
Hope this helps. I'm a newbie. There might be better ways to do what you
wanna do, but this works for me.
Thanks,
Prashanth

On Thu, 2004-10-07 at 18:53, Longfei Cong wrote:
> Hi:
>    Thank your for your answer first. But i find the similar in the maillist.
> Maybe i donot describe my problem well. I want to visual a vtkPolyData
> surface with  vector on each of the points on the surface mesh.
> wish for your help
> 
> ----- Original Message -----
> From: "Prashanth" <prashanth.dumpuri at vanderbilt.edu>
> To: <vtkusers at vtk.org>; <lflong at doc.ic.ac.uk>
> Sent: Thursday, October 07, 2004 12:18 PM
> Subject: Re:[vtkusers] surface with vector
> 
> 
> > Look into vtkHedgeHog. There is a similar question in the September 2004
> > archives. Hope this helps,
> > Prashanth
> > -----------------------------------------
> > Message: 6
> > Date: Thu, 7 Oct 2004 14:54:33 +0100
> > From: "Longfei Cong" <lflong at doc.ic.ac.uk>
> > Subject: [vtkusers] surface with vector
> > To: <vtkusers at vtk.org>
> > Message-ID: <00c101c4ac75$2ca553c0$9c05a992 at win.doc.ic.ac.uk>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > Hi everyone:
> > I want to visual a surface with normal vector on it. Is that  vtkGlyph3D
> > should be used here? I am  working on the windows. Could someone give
> > me some examples?
> >         Thanks a lot!
> >     longfeicong
> >
> >
> 




More information about the vtkusers mailing list