[vtk-developers] vtkWeightedTransformFilter added to contrib
David Gobbi
dgobbi at irus.rri.on.ca
Wed Mar 7 15:56:15 EST 2001
On Wed, 7 Mar 2001, Michael Halle wrote:
> 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.
Yes, getting rid of SetNumberOfTransforms is good enough. The reason
I objected to it was having a SetNumberOfTransforms method means that
people can set NumberOfTransforms incorrectly, having it automatic is
much better.
> 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.)
A linear of weighting of nonlinear transforms is a perfectly sensible
thing to do! Particularly if someone wants to morph from one nonlinear
transform to another. But for that sort of morphing it might make
more sense to have a vtkWeightedTransform (derived from
vtkAbstractTransform) that just accepts one weight per transform, not one
weight per transform per data point.
- David
More information about the vtk-developers
mailing list