[vtkusers] How can one fully specify orientation of vtkGlyph3Dglyphs?
Christopher Bruns
cmbruns at stanford.edu
Fri Jul 8 18:14:25 EDT 2005
Thank you John--
That was exactly what I needed. I replaced my vtkGlyph3D with a
vtkTensorGlyph. It works beautifully. Now I have added:
// This is not a complete working program...
vtkTensorGlyph tensorGlyph = new vtkTensorGlyph();
tensorGlyph.ExtractEigenvaluesOff(); // Treat as a rotation matrix,
not as something with eigenvalues
tensorGlyph.ThreeGlyphsOff();
tensorGlyph.SymmetricOff();
vtkFloatArray tensors = new vtkFloatArray();
tensors.SetNumberOfComponents(9);
lineData.GetPointData().SetTensors(tensors);
tensorGlyph.SetInput(lineData);
polyDataMapper.SetInput(tensorGlyph.GetOutput());
...
tensors.InsertNextTuple9(direction1.getX(),direction1.getY(),direction1.getZ(),
direction2.getX(),direction2.getY(),direction2.getZ(),
direction3.getX(),direction3.getY(),direction3.getZ());
...
(happy fish)
Thanks again!
-Chris
John Platt wrote:
>Hi Chris,
>
>Have you looked at vtkTensorGlyph? You could try ThreeGlyphsOff(),
>ExtractEigenValuesOff() and specify the orientation as the columns in
>point tensor data.
>
>HTH
>
>John.
>
>-----Original Message-----
>From: vtkusers-bounces+jcplatt=lineone.net at vtk.org
>[mailto:vtkusers-bounces+jcplatt=lineone.net at vtk.org] On Behalf Of
>Christopher Bruns
>Sent: 07 July 2005 22:37
>To: vtkusers at vtk.org
>Subject: [vtkusers] How can one fully specify orientation of
>vtkGlyph3Dglyphs?
>
>
> 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