[vtkusers] How to use and set axes in a 3D scene

German Larrain M. germanlarrainm at gmail.com
Thu Nov 10 15:15:45 EST 2011


Hi folks. I posted this question in
stackoverflow<http://stackoverflow.com/questions/7810632/how-to-use-and-set-axes-in-a-3d-scene>
more
than 3 weeks ago, unsuccessfully.
----------
I'm creating a simulator coded in python and based on ODE (Open Dynamics
Engine). For visualization I chose VTK.

For every object in the simulation, I create a corresponding source (e.g.
vtkCubeSource), mapper and actor. I am able to show objects correctly and
update them as the simulation runs.

I want to add axes to have a point of reference and to show the direction
of each axis. Doing that I realized that, by default, X and Z are in the
plane of the screen and Y points outwards. In my program I have a different
convention.

I've been able to display axes in 2 ways:

1) Image 1 <http://imagepaste.nullnetwork.net/viewimage.php?id=2610>

    axes = vtk.vtkAxes()
    axesMapper = vtk.vtkPolyDataMapper()
    axesMapper.SetInputConnection(axes.GetOutputPort())
    axesActor = vtk.vtkActor()
    axesActor.SetMapper(axesMapper)
    axesActor.GetProperty().SetLineWidth(4)

2) Image 2 <http://imagepaste.nullnetwork.net/viewimage.php?id=2611>(colors
do not match with the first case)

    axesActor = vtk.vtkAxesActor()
    axesActor.AxisLabelsOn()
    axesActor.SetShaftTypeToCylinder()
    axesActor.SetCylinderRadius(0.05)

In the second one, the user is allowed to set many parameters related to
how the axis are displayed. In the first one, I only managed to set the
line width but nothing else.

So, my questions are:

 - Which is the correct way to define and display axes in a 3D scene? I
just want them in a fixed position and orientation.
 - How can I set a different convention for the axes orientation, both for
their display and the general visualization?

Thanks,
Germán

-- 
Germán Larrain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111110/efc779bf/attachment.htm>


More information about the vtkusers mailing list