[Insight-developers] Hierarchy of Transformations : Math vs C++
Luis Ibanez
ibanez@cs.unc.edu
Wed, 20 Dec 2000 00:15:46 -0500 (EST)
Hi,
When trying to define a hierarchy for the RegistrationTransformation
class, it seems to be a contradiction between the sense of "is a"
as it is used in math, and as it is used in C++.
In math we say that:
- a Rigid transformation "IS A" Similarity transformation
- a Similarity transform "IS An" Affine transform
Here X "IS A" Y, means, X "is a particular case of" Y.
that is, an X is like a Y, but with some restrictions.
So X is not able to do all that Y can. (eg, a Rigid transform
cannot have a Shear() method)
In C++ on the other hand, when we say X "IS A" Y
that means that Y is a particular case of X.
Here, X is able to do anything that a Y can do, and
more.
---
The problem arises when we select the base class for
the hierarchy. If we follow the math, the base class
should be an Affine transform, and from it derive the
similarity transform, and then the rigid transform.
If we follow C++ the base class should be the one with the
minimum of capabilities, and its derivatives will add
functionality progresively. So the Rigid transformation
should be the base class, followed by the Similarity transform,
and then the Affine transform. In that way, the methods
like Rotate() and Translate() defined at the level of Rigid
transform can be called in a Similarity and Affine transform.
Scale() will be added at the Similarity level, and finally
Shear() will appear at the Affine level.
In any case, it seems to be convenient to use a matrix and
a vector as the internal representation of the Rigid transform.
In that way, each derivation will only have to add methods to
compute the matrix (linear part) and the vector (const part),
as they are currently defined in the AffineTransform class.
Does it makes sense ?
Thanks
Luis