[vtkusers] 3D Axes For User Orientation...

Andrea Gavana andrea.gavana at polymtl.ca
Tue Jul 13 16:05:55 EDT 2004


Hello NG,

      I have a problem regarding the display of 3D axes along with a VTK 
visualization to provide a user with orientation information. What I would like 
to have, is a small "window" in the bottom left corner of a VTK visualization 
figure in which there are the 3 axis (X-Y-Z) that give the orientation 
information to the user. Ideally, these axes should rotate as the user rotate 
the camera in the main window, but they should not be pickable/rotatable. The 
should be "untouchable"...
      By googling around, I found some solution, but unfortunately only with a 
small snippet of C/C++ code (I am not exactly a guru in C/C++, the 
contrary...), and for me it is not so clear.

This is what I found:

1) Use vtkCubeAxesActor2d with 2 different ViewPorts in the rendering window; 
this is a good solution, but I would like to have the axes displayed as 
tubes+cones (for the axis heads), or as arrows, with the 3 nice colors provided 
by VTK for the vtkAxes.
2) Use 2 ViewPOrts in the main window, with 2 renderers (one for each 
viewport). Draw the axis using a combination of 
vtkAxes+vtkTubeFilter+vtkConeSource in the second viewport and apply the camera 
of the first viewport to the second viewport. Unfortunately, in the first 
(main) viewport I have to use SetScale on all the Actors I have (surface, 
wireframe, polydata...), and when I set the camera (from the first viewport) to 
the second viewport, the axis in the second viewport disappear. I don't know 
how to set the position/scale of the axis in the second viewport (or the camera 
position) in order to apply to it the camera from the first viewport.

Does anyone have a solution? A snippet of code (Python/tcl/java)? At the moment 
I'm using Python, but everything is fine. If someone else has a different 
solution from the ones I proposed, everything is welcome.

Thank you for every suggestion.

Andrea.





More information about the vtkusers mailing list