[vtk-developers] Camera coordinate transformation for drawing and brushing overlays

max power zouookmoetenwerken at gmail.com
Tue Sep 11 03:45:46 EDT 2007


I'm currently writing a part of a vtk application where it is necessary to
have a 'brushing' type of overlay on top of the contents of a renderwindow.

The idea is that one can switch between moving the camera around, and a
so-called 'brushing mode'. In this mode two dimensional shapes can be drawn
(as annotations for example) directly on the viewport.

I've had some major problems trying to figure out where to best implement
this functionality. Currently, I've rigged a renderwindow to add an extra
overlay after rendering it's contents, and I've set up an interactor style
to capture the mouse movements.

However, I cannot make up my mind in which coordinate system I should store
the brushed points.  I would like my overlays to be invariant to
renderwindow size changes. Therefor all coordinate systems that have the
aspect ratio included in them (I mean they are normalized over the whole
window) seem to be unusable.
I've looked at VIEW and DISPLAY and their normalized variants, but the type
of coordinate system that I think would be best are camera coordinates
before the perspective projection.

However, this type of coordinate system does not seem to be generally
available. Going through the documentation and the source code seems to show
that there is no real coordinate transform step between view and world.  The
renderer (in worldtoview and such) seems to directly use the camera's
GetCompositePerspectiveTransformMatrix, while what I'd need would be
GetPerspectiveTransformMatrix.

I can make this transform myself by inverting the
perspectiveTransformMatrix, but this involves knowing the 'GetTileAspect()'
of the renderer and the near and far clipping plane, which seems to me a bit
too 'internal' and a bit of a kludge.

Could you recommend an other solution to this or tell me whether I'm on the
right track here?

ps. i've considered storing everything just in unprojected world
coordinates, which would make the rendering a lot easier, but then I also
have to keep track of the near clipping plane, and I'd prefer to just store
two-dimensional points instead of three.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20070911/06311ae7/attachment.html>


More information about the vtk-developers mailing list