POV-Ray : Newsgroups : povray.general : Look_at_macro : Re: Look_at_macro Server Time
30 Jul 2024 22:20:23 EDT (-0400)
  Re: Look_at_macro  
From: Chris B
Date: 12 Mar 2008 07:26:56
Message: <47d7cc10$1@news.povray.org>
"H. Karsten" <h-karsten()web.de> wrote in message 
news:web.47d7b9c5d9327eeb10a45770@news.povray.org...
> Here a little script, that should go, but it doesn't.
> It only works, if you use only one of the coordinates...
>

Hi,

If you look at Reorient_Trans in the help, I suspect that does exactly what 
you want.

The main problem with your code is that you've worked out the angles based 
on the initial position/orientation of the box. As soon as POV-Ray performs 
the first rotation (around x) it moves it out of it's initial 
position/orientation. The second rotation will therefore be around the 
y-axis of the scene and not around the axis of the box.

This can be a bit hard to get your head around, but imagine a 1 unit high 
line at the origin. Rotate through 45*x and then 45*y to get to a point P.

If I understand what you're trying to do in your calculation (though I 
haven't tested it), it should give you the y rotation, but would give a 
value for x that is less than 45 degrees because it's equivalent to 
projecting a line back onto the YZ plane at right angles, rather than 
rotating it back there around the y axis. Furthermore your calculation will 
give you an equal negative z rotation (a bit less than 45 degrees).

If you now think of applying the three rotations you calculate to the point 
<0,1,0>, the first two bring you to a point a short distance directly above 
point P. The third (around -z) takes you down somewhere close to the XZ 
plane.

Hope this helps.

Regards,
Chris B.


Post a reply to this message

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