[vtkusers] How to use and set axes in a 3D scene
Dženan Zukić
dzenanz at gmail.com
Fri Nov 11 03:46:36 EST 2011
Well, if you do not mess with objects' transformation matrix for display
purposes, it could probably be sufficient to just put your camera into a
different position while using axes approach 2. The easy methods to adjust
your camera position are: Pitch(), Azimuth() and Roll().
If you mess with object transforms, then apply the same transform to the
axes.
On Thu, Nov 10, 2011 at 21:15, German Larrain M.
<germanlarrainm at gmail.com>wrote:
> 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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111111/dccbbccb/attachment.htm>
More information about the vtkusers
mailing list