[vtkusers] Cool sample does not work, need help !!

Andrew Maclean a.maclean at cas.edu.au
Tue Sep 14 18:59:47 EDT 2004


It is definitely a cool sample!

As you indicate, what you have written works perfectly well for parallel
projections. If you look at DisplayToWorld() in your code, there is no
perspective transform being applied to the coordinates, so Pt4[3] will
always be 1. You are simply taking the viewport coordinates and converting
them to world coordinates. This is fine for parallel projections but not for
perspective projections.

For perspective projections, you actually need the view frustum and you can
get the planes bounding this from vtkCamera::GetFrustrumPlanes(), remember
:- the "aspect" is the width/height of the viewport. My initial approach
would be to construct a frustum from these planes and use the edges of the
nearest face as your bounding rectangle. This will also work for parallel
projections, however the frustum will simply become a cube in this case.

An alternative approach may be to use vtkCamera::
GetPerspectiveTransformMatrix() and vtkCamera::GetViewTransformMatrix() to
directly map the viewport bounds to word coordinates. However I think that
using vtkCamera::GetFrustrumPlanes() will be a better approach.


Let me know how this works. We (the users group) would love to see the final
result!


Regards,
   Andrew

___________________________________________
Andrew J. P. Maclean
Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney  2006  NSW
AUSTRALIA
Ph: +61 2 9351 3283
Fax: +61 2 9351 7474
URL: http://www.cas.edu.au/
___________________________________________





-----Original Message-----
From: de Boer Ingo [mailto:I.deBoer at polytec.de] 
Sent: Friday, 10 September 2004 21:18
To: vtkusers at vtk.org
Cc: vidyadhar at lucidindia.net
Subject: [vtkusers] Cool sample does not work, need help !!

Hi all,

Vidyadhar and I are working on this cool zoom sample.
We have a cube in a large and small renderer. Now, when
you zoom into the large renderer, you see a red rectangle
in the small renderer to show you the zoomed ROI from
the large renderer... well... play with it, you'll get it ;)

There is still a problem :(

The sample only works okay in parallel projection. The
perspective projection does not work !!

So, this goes out to all the VTK gurus to take a look at
this. This sample could also be a nice one for the VTK CVS
and very usefull to some other users.

You can toogle the perspective/parallel with the line

#define _WORKING_SAMPLE_


greets
  Ingo


---
Dr.-Ing. Ingo H. de Boer

Polytec GmbH
Polytec-Platz 1-7, 76337 Waldbronn, Germany
phone: ++49 7243 604 106
fax  : ++49 7243 604 255





More information about the vtkusers mailing list