POV-Ray : Newsgroups : povray.advanced-users : camera math help please : Re: camera math help please Server Time
30 Jul 2024 12:19:52 EDT (-0400)
  Re: camera math help please  
From: Uwe Zimmermann
Date: 26 Jul 1999 07:49:00
Message: <379C4B2B.DE5D684C@ele.kth.se>
> // yes, the trace function from Superpatch. testobject: first a sphere,
> then the world!

You don't need Superpatch at all!

Given your position on the sphere in longitude (phi) and lattitude (psi)
and the horizontal based direction of view in azimut (0 degrees north,
90 degrees east ...) and height (0 degrees horizon, 90 degrees zenit)
you get the direction of view in cartesian coordinates (left handed, y
up - for POV) with the following few lines. If you are just looking for
the horizontal orientation of your camera, you just set the height to
zero and the azimut to the desired direction. You can then use the
vector zenit which stands perpendicular on the sphere as the upward
direction of your camera.

#declare degree=pi/180;   /*  I know that there is a function "rad", 
                              but I think this is more readable */
                                                                              
#declare phi=0*degree;  
#declare
psi=-60*degree;                                                        
#declare r=1.002;

#declare azimut=0*degree;
#declare height=0*degree;

#declare position= r * < cos(psi)*cos(phi), sin(psi),
-cos(psi)*sin(phi)>;
#declare zenit   =     < cos(psi)*cos(phi), sin(psi),
-cos(psi)*sin(phi)>;

#declare north   =     <-sin(psi)*cos(phi), cos(psi), 
sin(psi)*sin(phi)>;
#declare east    =     < sin(phi)         , 0       ,  cos(phi)        
>;

#declare direct  = north*cos(azimut) + east*sin(azimut) +
zenit*sin(height);



Uwe.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.