|
![](/i/fill.gif) |
"H. Karsten" <h-karsten()web.de> wrote in message
news:web.47d7cf1fd9327eeb10a45770@news.povray.org...
> 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?
>
Looking at your earlier code you've got a sphere whizzing around at y=3 and
a box at the origin. If I understand correctly you want the centre of the
top of the box to point at the sphere and you don't seem bothered about the
orientation of the box around the centre line between the box and the
sphere. If this is the case, then you can always achieve this with only two
rotations. ie You can tilt the box with a rotation in x and then spin it
round the y axis to point at any point on the plane y=3 (indeed at any point
in 3D space).
There are quite a few standard POV-Ray macros that could help with this, but
you might want to look at VRotationD(V1, V2, Axis) and use it to work
backwards through the 2 rotational axes that you need. For example:
#include "math.inc"
#declare P = <-30,3,5>;
#local TempP = P;
#debug concat("Normalised Point: ",vstr(3,vnormalize(P),",",3,3),"\n")
// Work out the angle between the z axis and
// a point projected down onto the XZ plane
#local YRot = VRotationD(z, TempP*<1,0,1>, y);
// Bring the point back onto the YZ plane
#local TempP = vrotate(TempP,-y*YRot);
// Work out the x rotation
#local XRot = VRotationD(y, TempP, x);
#debug concat("Should be the same:
",vstr(3,vrotate(y,<XRot,YRot,0>),",",3,3),"\n")
Regards,
Chris B.
Post a reply to this message
|
![](/i/fill.gif) |