Home Products Download Order Contacts


Subject: Re: Lineal algebra problem

"guanaco" wrote in message
> 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.

th=atan2(D.x, D.z)

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).
opengl will leave you looking in the -Z direction by default (X right, Y
most 3D engines I have seen have Z up, X right, and Y forwards;


View All Messages in comp.graphics.algorithms

Lineal algebra problem =>

Re: Lineal algebra problem
Re: Lineal algebra problem

Copyright 2006 WatermarkFactory.com. All Rights Reserved.