Plans for the new vtk*Transform classes

David Gobbi dgobbi at irus.rri.on.ca
Mon Apr 17 23:37:15 EDT 2000


Hi all,

As people have probably noticed, I've been doing a fair bit of
work adding new geometrical transformation code to VTK.  My goal
is to eventually replace much of the existing 4x4 matrix code
in the VTK classes (particularly the Camera, Prop3D, Renderer,
and Picker) so that it uses the new transform classes.

So, since this is going to change VTK quite a bit, it's probably a good
idea if I explain why I want to do it.  Here are the reasons.

1) It will drastically simplify many core VTK classes.  If anyone
   wants an example, just yesterday I removed over 250 lines of
   code from vtkCamera -- almost 1/4 of the file.  The calculations
   that used to be done in these 250 lines of code is now done
   by 5 methods in vtkProjectionTransform that total 130 lines of code.

2) Efficiency - by pipelining transforms, it is possible to guarantee
   that they are only updated when they have to be (most VTK methods
   will re-generate transforms each time they are requested).  It is
   hard to say what real impact this will have on rendering speed, though.

3) To make it easier to move between the various coordinate systems in
   VTK.  Wouldn't it to be nice, for example, to be able to transform
   a point from world coordinates to mapper coordinates just by doing
 
   actor->GetTransform()->GetInverse()->TransformPoint(worldXYZ,dataXYZ)

   or to be able to move a whole bunch of display coords to world coords
   using

   transform = renderer->GetDisplayToWorldTransform()
   transform->TransformPoint(point0,point0)
   transform->TransformPoint(point1,point1)
   ...

4) To make new things possible in VTK.  For example, imagine that you
   want to write a flight simulator in VTK, and have to set up a spot
   plane.  Well, you could write a vtkFollowerTransform that will 'follow'
   its input vtkTransform but will incorporate damping factors and the
   like to make it 'follow' the lead plane just like a real spot plane
   would.  This requires that A) you can get a pipelined transform from
   a vtkActor, which is currently not possible, and B) that the
   'spot-plane' vtkActor has a SetUserTransform() method that can accept
   a pipelined transform.  (Note: every single one of the transforms in
   the vtkGeneralTransform heirarchy is a 'pipelined' transform, that part
   of the work is already done).

5) Closely linked to (4), it will make VTK much easier to use and much
   more featureful for real-time animation.  My area of expertise is
   real-time guidance for neurosurgery, and just about everything I do
   involves a dynamically changing scene rather than static visualization.
   And VTK is _very close_ to being an ideal package for dynamic
   visualization.

6) Finally, for myself, I would like to become intimately familiar with
   VTK internals.  This is partly due the fact that I plan to continue
   using VTK to develop surgical guidance applications for some years to
   come, and am pretty darn sure that there are still a number of 
   significant bugs left in VTK.  The nightly regression testing is all
   well and good, but many bugs that aren't caught by regression tests
   stick out like a sore thumb when you read through the code.


Now, one big problem is the changes required, especially if they are to
be done right, are pretty massive.  As far as I can see, though, it should
be possible to implement them without breaking compatibility.  So, is
anyone interested in helping out?  In particular I would be greatful if
someone was willing to write tcl regression tests for any new features
(e.g. the vtkProjectionTransform could use one) or to modify existing
vtk classes and examples to use the new transform classes and methods.
Or someone could help with the required core changes to vtkProp3D,
vtkRenderer etc.  but I'd have to warn such a person that I'm an
extreme nitpicker when it comes to code and even more so when it comes
to design.

Opinions are welcome.  I'll step off my soapbox now.

 - David

--
  David Gobbi, MSc                    dgobbi at irus.rri.on.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario




More information about the vtk-developers mailing list