POV-Ray : Newsgroups : povray.general : Look_at_macro : Re: Look_at_macro Server Time
30 Jul 2024 22:23:12 EDT (-0400)
  Re: Look_at_macro  
From: Tim Attwood
Date: 12 Mar 2008 23:14:20
Message: <47d8aa1c$1@news.povray.org>
> Well I saw, that the includefile makes the transformation itself.
>
> As I open it, the transformaton was made with the matrix keyword.
>
> But I need to have three values that I can assign to the normal rotate 
> <...>
> keyword. Because, I need to write this values in to a file!
>
> Maybe by using the "vaxis_rotate(...)" command?

A full set of rotations really consists of two rotations,
elevation and Y rotation, the third is really just to control
the "up" or "roll" direction. There's not really enough info
in a single vector to determine the desired "up" direction
in all cases. So this code just assumes it starts with Y as
up. The selects are to determine the general direction of
the angles...

//+kff360
#include "math.inc"
#declare P = <2*sin(clock*60),3,4*sin(clock*36)>;
#declare Ay = select(P.x,-VAngleD(z,<P.x,0,P.z>),
                 0,VAngleD(z,<P.x,0,P.z>));
#declare Ax = select(P.y,VAngleD(P,vrotate(z,Ay*y)),
                 0,-VAngleD(P,vrotate(z,Ay*y)));
sphere {P,0.05
   pigment {Red}
}
cone {<0,0,0>,0.05,<0,0,0.5>,0
   pigment {Cyan}
   rotate Ax*x
   rotate Ay*y
}
#debug concat("Elevation = ",str(Ax,0,3)," degrees.\n")
#debug concat("Y Rotation = ",str(Ay,0,3)," degrees.\n")


Post a reply to this message

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