Re: [eigen] Eigen appears to rock.

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


100% agree with Gael. Another argument against Point is that it means more types hence more code instantiated for the same thing. For example, the Point+Vector addition is exactly the same as Vector+Vector, so let's not make it generate the same code a second time.

One remark by the way:
T.affine() is the 3x3 affine part of the above 4x4 matrix (it
represents the rotation + scale + shear)

I didn't realize that this method was called affine(). Why? To me, the whole 4x4 matrix is an affine transformation (which means linear transformation combined with translation) and the topleft 3x3 block is the _linear_ part. So, how about renaming affine() to linear() ?

Quoting Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
Anyway, this let me though Transform could be slightly improved by
adding the following explicit shortcuts:

Vector3 transformPoint(Vector3) const;
Vector3 transformVector(Vector3) const;
Vector3 transformDifferentialVector(Vector3) const;
Matrix3 normalMatrix() const;

I'm not sure about transformDifferentialVector because it is very slow
if you transform more than a single vector.
normalMatrix() would returns the transformation matrix you have to use
to transform your normals.

IMHO this goes too far in the way of letting people rely on Eigen without understanding the math.

transformPoint is just operator* right? so let's keep just operator*.
transformVector is .affine().operator* right? again let's rename it to ..linear().operator* if you agree, and IMHO it's good to make users call it that way. transformDifferentialVector and normalMatrix: if we wanted such shortcuts the first problem would be to find appropriate names: very hard! Then I don't think that's really needed.

Cheers,
Benoit


cheers,
gael.


On Thu, Aug 21, 2008 at 6:22 AM, Thomas Vaughan <tevaughan@xxxxxxxxx> wrote:
On Wed, Aug 20, 2008 at 9:31 PM, Benoît Jacob <jacob@xxxxxxxxxxxxxxx>
wrote:

Thanks for the kind words!

You're welcome!

For example, Transform3f is actually a 4x4 matrix and can represent
any affine transformation on 3-space. You can multiply a Transform3f
with a Vector3f.

Hmm.  This seems a bit unfortunate.  In my naive imagination, although
each of a Vector and a Point should have three components internally,
ideally:

 - Applying a Transform to a Vector should give only a rotation, whereas
  applying the same Transform to a Point should give both a rotation
  and a translation,

 - The binary subtraction operator between two Points should return the
  displacement Vector from one point to the other.

 - The binary addition operator between a Point and a Vector should
  return the Point at the head of the Vector when its tail rests at the
  Point operand.

 - Most ordinary matrix stuff should work for a Vector, but only a few
  things, like those above, and individual coordinate access, should
  work for a Point.

I've noticed that some nasty bugs can happen in application code because
there is no proper distinction enforced between a Point and a Vector.
For example, I've made the mistake of accidentally transforming point
coordinates as though they were vector components.  If a quantity were
declared as a Point, then it would be nice by C++ typing to have the
compiler warn the programmer that he is trying to treat something as
though it were a Vector when it is really a Point.  Alternatively it
would be nice for the compiler just to do the appropriate thing
automatically in the case of a coordinate transformation.

Maybe, in the multiplication against the Transform, this would be as
simple as

 - converting a Vector to a four-dimensional column whose w-component is
  zero but

 - converting a Point to a four-dimensional column whose w-component is
  one.

I notice that operator* for Transform takes either an N-dimensional
vector or an (N+1)-dimensional homogeneous vector.  Does "homogeneous
vector" imply unit value in the (N+1)-component?  What (N+1)-component is
supplied for the N-dimensional vector in this case?

--
Thomas E. Vaughan

There are only two kinds of people; those who accept dogma and know it,
and those who accept dogma and don't know it. - G.K. Chesterton







----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/