This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Multiplication of Projective2d with Vector2d

Tags: None
(comma "," separated)
gagabla
Registered Member
Posts
1
Karma
0
Reading the tutorial part 8 "Geometry" i got the impression that the following should be possible:

Code: Select all
Transform<double, 2, Projective> t;
Vector2d p;
Vector2d q = t * p;


But when compiling i get the following error:
Code: Select all
Core/Product.h(583): error C2338: INVALID_MATRIX_PRODUCT


Replacing the transform type Projective by Affine in the code, the multiplication compiles (and works) fine.

There is a workaround by homogenizing manually, but isn't that done internally?

I am using Eigen 3.0.5 with MSVC 10.

Kind regards
Janosch
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
right, there must be a good reason for that but I cannot remember. The solution is to explicitly use homogeneous vectors:

q = (t * p.homogeneous()).hnormalized();
Hauke
Registered Member
Posts
109
Karma
3
OS
gagabla wrote:There is a workaround by homogenizing manually, but isn't that done internally?


This is not done internally because in the projective case you can map any 2D point to a point at infinity. A point at infinity (or ideal point) has a homogeneous coordinate of 0 and such a point cannot be normalized.

HTH,
Hauke
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
on the other hand, I think that the ".homogeneous()" could be implicit just like it is the case with Affine transforms.
Hauke
Registered Member
Posts
109
Karma
3
OS
ggael wrote:on the other hand, I think that the ".homogeneous()" could be implicit just like it is the case with Affine transforms.


You'ld be risking Inf entries but maybe that is reasonable when the user explicitly requests the transformation of 2D points. So, I agree, we might adapt the code.

Regards,
Hauke


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]