[vtk-developers] vtkWeightedTransformFilter added to contrib

Michael Halle halazar at media.mit.edu
Wed Mar 7 14:26:15 EST 2001


David raises these fine points:

  For the sake of similarity with othe VTK classes, you might want to
  get rid of 'SetNumberOfTransforms()' and instead use
  AddTransform()/RemoveTransform().  Take a look at
  graphics/vtkAppendFilter.h or imaging/vtkImageMultipleInputFilter.h.

I think numbering the transforms makes sense, since the transforms 
are ordered: elements of the weight vector must match up with the
transforms.    The data set code uses "SetNumberOfComponents" and
"SetComponent", while the filter uses "SetNumberOfTransforms" and
"SetTransform".  I could make the transform vector size automatically,
though, getting rid of SetNumberOfTransforms.

  Also, you copied the 'LinearTransformVector' inline functions into
  your code.  Why?  It would have been cleaner if you had just 
  used transform->TransformPoint() and transform->TransformNormal()
  directly for each if the input transforms.  

Efficiency.  For linear transforms (the ones that will be used most
frequently with this code), I can pre-invert and transpose the
matrices for the normals.  I'm saving lots of math for the most common
case, and by duplicating on the order of ten lines of straightforward
code.  The cost is that I can only do linear transforms.  I may code
an additional "slow path," using the method you describe, that allows
for arbitrary transforms in the general case.  (Since the weighting
is a linear combination, non-linear transforms are a little strange
anyway.)

Thanks for your suggestions!


							--Mike





More information about the vtk-developers mailing list