[Insight-developers] itkPoint from a math perspective
Damion Shelton
dmsst59+@pitt.edu
Tue, 17 Jul 2001 14:51:25 -0400
Wow... thanks for the in-depth explanation.
> Dot product is not defined over points in space,
> but over vectors, representing the projection of
> one vector over the other.
Agreed. The intended use is the following; there are two points in space, A
and B. When I want to take the dot product of the two, what I intend to do
is to take the dot product of the two vectors from origin->A and origin->B.
By making the naive assumption/representation of points as vnl_vector_fixed,
I could simply say:
dot_product(pointA, pointB);
Using the point syntax, I have to say:
dot_product(pointA.GetVectorFromOrigin().Get_vnl_vector(),
pointB.GetVectorFromOrigin().Get_vnl_vector() )
I think this illustrates the extra "wordiness" imposed by the itkPoint way
of representing things. I would agree that this perhaps is "clearer" than a
more fast-and-loose way of data representation, but it does impose four
extra function calls per dot product call, plus a data type conversion.
I suppose that since the * Vector method implies the scalar/dot product, I
could also say:
( pointA.GetVectorFromOrigin() )*( pointB.GetVectorFromOrigin() )
> The typical experience in computer graphics is that
> these types are often used in the wrong sense, just
> because all look like n-d arrays.
Perhaps, but often times the point/vector distinction is implied by the way
the data type is used rather than explicitly in the data type.
Another example would be averaging the position of two points, as in PointC
= (PointA + PointB) / 2
This operation is defined when the point/vector distinction isn't present.
When the distinction is made, the operation has to be expressed as:
PointC = PointA + (PointB-PointA) / 2
I'm not saying that this is terribly inconvenient or anything, nor am I
neccessarily suggesting changing anything about the Point/Vector
distinction. But, it might be worthwhile to spend extra time in the beta
documentation talking about how these types are meant to be used.
Thanks,
-Damion-