Home Products Download Order Contacts

comp.graphics.algorithms

Subject: Re: Lineal algebra problem




"guanaco" wrote in message
news:1145235014.461387.155400@z34g2000cwc.googlegroups.com...
> Hi, I am having problems with transformation matrices. Suppose the
> camera is in the origin (0 0 0) and pointing to positive "z" (0 0 1).
> Positive "x" is at the right and positive "y" is up. I need to move the
> camera to a point P1 (the look-from) pointing to another point P2 (the
> look-to). Is there a general procedure to do this with translations and
> rotations?
>
thought it was in the faq, but I don't know...

general approach:
move the camera to P1;
point the camera at P2.

there is a vector from P1 to P2, which can be useful here.

D=((P2-P1)/|P2-P1|)
th=atan2(D.x, D.z)
r=asin(D.y)

where th is yaw and r is pitch (note, in c at least these functions return
the result in radians, which may or may not be what is desired).

then again, there are alternate definitions of camera orientation, so I gave
angles. likewise, you didn't specify a lot of things, so likely you will
need to fudge out the rest on your own.


likewise, whether or not it was intentional, the space described is left
handed (in my experience right handed systems are more common).
eg:
opengl will leave you looking in the -Z direction by default (X right, Y
up);
most 3D engines I have seen have Z up, X right, and Y forwards;

Reply


View All Messages in comp.graphics.algorithms

path:
Lineal algebra problem =>

Replies:
Re: Lineal algebra problem
Re: Lineal algebra problem

Copyright 2006 WatermarkFactory.com. All Rights Reserved.