# comp.graphics.algorithms

## Subject: Re: Lineal algebra problem

Thanks, I will try that method.

I am learning Renderman and having problems specifying the camera. It
uses a left-handed system and it seems the camera is fixed and the
"world" system is placed relative to the camera (and not vice versa).

cr88192 wrote:
> "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.
>
> 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;
> ...
>
> but these are right handed spaces.
>
> > Thanks
> >