tirengarfio

09-18-2006, 08:28 AM

Hi to all,

First of all i wanted to see if the stages (http://scr.csc.noctrl.edu/courses/csc425/Resources/transform.gif) for transforming coordinates works. So i have used the coordinate (10, 10, 10) this way:

First, I have convert the Object Coordinates to Eye Coordinates:

[ xe ] [ 3 0 0 10 ] [10] [ 40 ]

[ ye ] = [ 0 3 0 6 ] [10] = [ 36 ]

[ ze ] [ 0 0 3 0 ] [10] [ 30 ]

[ we ] [ 0 0 0 1 ] [ 1] [ 1 ]Then, I find the Clip Coordinates, that are the same as the Normalized Device Coordinates

[ xd ] [ 0.010 0.000 0.000 0.000 ] [ 40 ] [ 0.40 ]

[ yd ] = [ 0.000 0.010 0.000 0.000 ] [ 36 ] = [ 0.36 ]

[ zd ] [ 0.000 0.000 0.005 0.000 ] [ 30 ] [ 0.15 ]

[ wc ] [ 0.000 0.000 0.000 1.000 ] [ 1 ] [ 1 ]And finally, I get the Window Coordinates with this relation:

[ xw ] [ (px/2)xd + ox ]

[ yw ] = [ (py/2]yd + oy ]

[ zw ] [ (f-n)/2]zd + (n + f)/2 ]

px=200

py=200

ox=0

ox=0

n=200

f=-200

[ xw ] [ 100 * 0.40 ] [ 40 ]

[ yw ] = [ 100 * 0.36 ] = [ 36 ]

[ zw ] [ ((-400)/2)*0.15 + 0/2 ] [-30 ]It works ok, but, what is zw (-30)?

Now, i would like to find a Object Coordinate from a Window Coordinate, but, how can i find it if i dont know zw?

Or in other words, What is the winz value in the gluUnproject (http://www.mevis.de/opengl/gluUnProject.html) function?

First of all i wanted to see if the stages (http://scr.csc.noctrl.edu/courses/csc425/Resources/transform.gif) for transforming coordinates works. So i have used the coordinate (10, 10, 10) this way:

First, I have convert the Object Coordinates to Eye Coordinates:

[ xe ] [ 3 0 0 10 ] [10] [ 40 ]

[ ye ] = [ 0 3 0 6 ] [10] = [ 36 ]

[ ze ] [ 0 0 3 0 ] [10] [ 30 ]

[ we ] [ 0 0 0 1 ] [ 1] [ 1 ]Then, I find the Clip Coordinates, that are the same as the Normalized Device Coordinates

[ xd ] [ 0.010 0.000 0.000 0.000 ] [ 40 ] [ 0.40 ]

[ yd ] = [ 0.000 0.010 0.000 0.000 ] [ 36 ] = [ 0.36 ]

[ zd ] [ 0.000 0.000 0.005 0.000 ] [ 30 ] [ 0.15 ]

[ wc ] [ 0.000 0.000 0.000 1.000 ] [ 1 ] [ 1 ]And finally, I get the Window Coordinates with this relation:

[ xw ] [ (px/2)xd + ox ]

[ yw ] = [ (py/2]yd + oy ]

[ zw ] [ (f-n)/2]zd + (n + f)/2 ]

px=200

py=200

ox=0

ox=0

n=200

f=-200

[ xw ] [ 100 * 0.40 ] [ 40 ]

[ yw ] = [ 100 * 0.36 ] = [ 36 ]

[ zw ] [ ((-400)/2)*0.15 + 0/2 ] [-30 ]It works ok, but, what is zw (-30)?

Now, i would like to find a Object Coordinate from a Window Coordinate, but, how can i find it if i dont know zw?

Or in other words, What is the winz value in the gluUnproject (http://www.mevis.de/opengl/gluUnProject.html) function?