[vtkusers] How can one fully specify orientation of vtkGlyph3D glyphs?

Christopher Bruns cmbruns at stanford.edu
Thu Jul 7 17:37:19 EDT 2005


  Using glyphs is so very very much faster than using thousands of 
individual vtkActors.
  But I cannot figure out how to fully specify the orientation of the 
glyph at each position.
  Calling SetVectorModeToUseNormal() certainly has an effect on the glyph
orientation, but leaves one entire degree of freedom unspecified.

  For example, suppose each glyph were the shape of a fish.  I could 
specify the
direction from the tail to the head of the fish by setting the normal 
vector at
each position appropriately.  But I cannot figure out how to also 
specify the
directions toward which the fish's tummy and back and left side and 
right side face.  There is
one rotational degree of freedom that is not captured by the normal vector
orientation.

  So fish orientations cannot be fully specified in a vtkGlyph3D.  
Spheres are OK.
Cones are OK. Cylinders are OK.  Anything with an axis of radial 
symmetry is OK.
Tacos are not OK. Fish are not OK.

  Does anyone have an example of how to fully specify the orientation in 
three
dimensions of each glyph?  Alternatively, are there non-glyph tricks for 
getting
thousands of identical things rendered without resorting to 22nd century
hardware?

  Thanks in advance.

Chris Bruns

// This is in Java
vtkGlyph3D lineGlyph = new vtkGlyph3D();
vtkPoints linePoints = new vtkPoints();
vtkFloatArray lineNormals = new vtkFloatArray();
lineNormals.SetNumberOfComponents(3);
lineGlyph.SetVectorModeToUseNormal(); // Take direction from normal
lineGlyph.SetSource(complexAsymmetricShape.GetOutput());
...
// Populate the positions and normal vectors for each object...
  linePoints.InsertNextPoint(center.getX(), center.getY(), center.getZ());
  lineNormals.InsertNextTuple3(direction.getX(), direction.getY(), 
direction.getZ());
...
vtkPolyData lineData = new vtkPolyData();
lineData.SetPoints(linePoints);
lineData.GetPointData().SetNormals(lineNormals);
...
(unhappy fish)




More information about the vtkusers mailing list