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

Tranform matrix

Tags: None
(comma "," separated)
bennih
Registered Member
Posts
21
Karma
0
OS

Tranform matrix

Mon Aug 19, 2013 7:01 pm
Hello!

Iam totally new to Eigen. Currently iam writing my bachelor thesis in Electronical Engeneering and i had to use Eigen :D
I just want to create a Transform object containing translate, scale and rotate and apply it to a point.
After reading some stuff in the documentation i came to this:

# include <i o s t r e a m >
# include <Eigen / Dense>
using namespace Eigen ;
int main ( )
{
Vector3f P1 , P2 , t , s , r_axis ;
P1 << 1 , 0 , 0 ;
t << 2 , 2 , 2 ; // translation vector
s << 2 , 2 , 2 ; // scale vector
r_axis << 1 , 0 , 0 ; // rotate around this axis -> x
Transform<float , 3 , Affine> M = Translation3f ( t ) ∗ AngleAxisf ( 0 . 5 2 , r_axis ) ∗ Scaling ( s ) ;
P2 = M ∗ P1 ;
return 0 ;
}

this gets me a big wall of errors i dont understand well.
my problem is i have got only 2 days left before the end of my thesis, so i havent got the time to crawl through all the documentation.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Tranform matrix

Thu Aug 22, 2013 10:13 am
For the record, you have to split that line (c++ issue):
Code: Select all
Transform<float , 3 , Affine> M;
M = Translation3f ( t ) ∗ AngleAxisf ( 0 . 5 2 , r_axis ) ∗ Scaling ( s ) ;
bennih
Registered Member
Posts
21
Karma
0
OS

Re: Tranform matrix

Fri Aug 23, 2013 9:31 pm
Hi, thanks!

ich changed it to this:

#include <iostream>
#include "Eigen/Dense"

using namespace Eigen;

int main ( )
{
Vector3f P1 , P2 , t , s , r_axis ;

P1 << 1, 0, 0;
t << 2, 2, 2; // Translationsvektor
s << 2, 2, 2; // Skalierung
r_axis << 1, 0, 0; // Um die Achse wird gedreht

Transform<float,3,Affine> M;
M.translate(t);

//P2 = M ∗ P1 ;

return 0 ;
}


this actually works but if i uncomment the line P2 = .. than it doesnt work

i dont know why..

greetings.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Tranform matrix

Sat Aug 24, 2013 7:19 pm
what's wrong? it works for me.
bennih
Registered Member
Posts
21
Karma
0
OS

Re: Tranform matrix

Sun Aug 25, 2013 8:18 am
even if you uncomment "//P2 = M * P1" -> "P2 = M * P1"?!

My only Problem is i cant apply the Transformation to a point!

greetings Benni
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Tranform matrix

Sun Aug 25, 2013 11:33 am
yes. Please post your errors, how can we help without them?
bennih
Registered Member
Posts
21
Karma
0
OS

Re: Tranform matrix

Sun Aug 25, 2013 5:51 pm
Hi,

yes i know. the problem is its on german. i dont know how to switch the language of the compilermessages.
Maybe you compile the code on your own?

i appreciate your help! thanks so far.

Benni
jitseniesen
Registered Member
Posts
204
Karma
2

Re: Tranform matrix

Sun Aug 25, 2013 7:37 pm
When I copied-and-pasted your program, I found that the asterisk in the line
Code: Select all
P2 = M ∗ P1 ;
is not the normal asterisk denoting multiplication, but another character (compare normal * with your ∗ ). I don't know how this happened, but that might be your problem. Apart from that, the program works fine.

If this does not solve it, give us the error message in German (perhaps with your translation) and the version of Eigen and the compiler that you are using.
bennih
Registered Member
Posts
21
Karma
0
OS

Re: Tranform matrix

Mon Aug 26, 2013 2:08 pm
Hello,

yes the asterisk was not rigth. I have absolutely no clue how this happend. Took me hours trying to solve my "Eigen problem".
Thank you very much sir.

greetings


Bookmarks



Who is online

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