[vtkusers] How to view Front, Top, Bottom, etc views of an object?

Shashwath T.R. trshash at gmail.com
Mon May 9 22:39:28 EDT 2011


Hi,

You need to work with the camera. Basically, there are three ivars you can
work with in vtkCamera:

1. The FocalPoint - this controls the point the camera "looks" at.
2. The Position - this controls _where_ the camera is in space.
3. The ViewUp - this controls what the "up" direction is (i.e., the
direction that goes bottom-to-top in the view).

The constraint is that ViewUp should be orthogonal to the direction from
Position to FocalPoint (this is accessible through
GetDirectionOfProjection).

There are convenience functions to set these too (like SetRoll, which rolls
the camera around the DirectionOfProjection).

Normally, what I do is,
a) Move the FocalPoint to the center of my object, or wherever on the object
I want to center my view
b) Move the Position to a point in the corresponding axis. For looking from
positive X, I move the camera to something like (1, 0, 0).
c) Set the ViewUp to whatever should be the appropriate up vector for my
scene - (0, 0, 1) for Z axis.
d) Call ResetCamera on the renderer to give me the full view. There's also
an overload to ResetCamera that takes bounds, so that you can reset to view
only a specific region.

You can either have multiple cameras and call SetActiveCamera on the
renderer, or get the camera from the renderer, and manipulate it.

HTH
Shash

On Mon, May 9, 2011 at 12:16 PM, Nelson <gnjoseph at gmail.com> wrote:

>  Hi David,
>
>
>
> Thanks for your help.
>
> As in the *Paraview*, I want to create different views of an object. As
> you aware the following toolbar does this operation.
>
>
>
> [image: Capture.PNG]
>
>
>
> I am also keep trying to create such views of an object.
>
> I am anticipating your reply.
>
>
>
> Regards,
>
> Nelson
>
>
>
> *From:* David Doria [mailto:daviddoria at gmail.com]
> *Sent:* Saturday, May 07, 2011 2:06 AM
> *To:* Nelson
> *Cc:* vtkusers at vtk.org
> *Subject:* Re: [vtkusers] How to view Front, Top, Bottom, etc views of an
> object?
>
>
>
> On Wed, Mar 16, 2011 at 1:18 AM, Nelson <gnjoseph at gmail.com> wrote:
>
> Hi All, I am using *vtkLSDynaReader*. I am able to render the d3plot file
> with *vtkInteractorStyleTrackballCamera.* I want to view the Front, Back,
> Top, Bottom, Right, Left views of it. How to get those views? Thanks in
> advance.
>
> Best Regards,
> Nelson
>
>
>
> Did you ever get it to work? Either way, we should make this into an
> example. I think you'd just need 6 viewports:
>
>
>
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/MultipleViewports
>
>
>
> each with its camera positioned appropriately. Maybe the above link will
> give you somewhere to start. If you're still having problems, post your
> attempt under "wish list" on the examples page and we'll take a look.
>
> David
>
> _______________________________________________
> 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/20110510/f6a1d3f7/attachment.htm>


More information about the vtkusers mailing list