Main Page | Report this Page
Computers Forum Index  »  Computer - Graphics - API (Opengl)  »  trasforming versor gives strange result...
Page 1 of 1    

trasforming versor gives strange result...

Author Message
Michal...
Posted: Mon Aug 24, 2009 7:20 pm
Guest
I wanted to find vector pointing up for current model so i tried to did
it like that:
1. Created two points a, b such that a - b points up and this is unit
vector:
float a = {0, 1, 0, 1};
float b = {0, 0, 0, 1}
2. Multiplied this points by current Modelview matrix:
c = Modelview * a;
b = Modelview * b;
3. i have extracted up wector like this:
up_vector = c - b;

but i did not work for me. I do not know why i thought that when i
transfortm y-axis versor by current transformation matrix i should get
vector that points up in local coordinate system. When i use this vector
to draw square it is rotated on screen counterclock wise. And when
i compare up_vector with proper up vector it turns that y-value of my
vector is same as y value of proper up vector but x and z are diferent.

Could somebody explain it to me?



P.S i know how to find up vector but i wonder why my method does not
work.

--
 
Michal...
Posted: Mon Aug 24, 2009 8:18 pm
Guest
ok, i multiplied modelview by y-versor by hand i get this result:
up = M * yv = [m4 m5 m6] equation (1)

where M is modelview and it looks like this:
M =
[m0 m4 m8 m12]
[m1 m5 m9 m13]
[m2 m6 m10 m14]
[m3 m7 m11 m15]

but by up vector i mean vector which points up when drawed on the
screen with current modelview matrix. It turns that this vector is
[m1 m5 m9]. I am very confused why equation (1) did not produce up
vector.

--
 
 
Page 1 of 1    
All times are GMT
The time now is Fri Dec 11, 2009 9:45 pm