POV-Ray : Newsgroups : povray.newusers : rotations and translations : Re: rotations and translations Server Time
28 Jul 2024 14:19:03 EDT (-0400)
  Re: rotations and translations  
From: kurtz le pirate
Date: 11 Nov 2008 08:47:58
Message: <kurtzlepirate-703C3E.14473911112008@news.povray.org>
In article <491886ec$1@news.povray.org>, "Chris B" <nom### [at] nomailcom> 
wrote:

> "kurtz le pirate" <kur### [at] yahoofr> wrote in message 
> news:kurtzlepirate-B3CE05.17471210112008@news.povray.org...
> >
> > i have 3 points in space. the plan goes through these three points can
> > be defined as :
> >
> >  plane {vcross (P2-P1,P3-P1),0 translate P1}
> >
> > ok... but now, how to find angles beteewn "standard (0,x,y,z)" and this
> > new "coordinate system" ?
> >
> > eulers's angles seem to be the solution but I do not see how to compute
> > it :(
> >
> > any help ?
> 
> The example below shows one way, using transforms.inc to work out the 
> transformation necessary.
> It looks a lot of SDL, but the transform calculation is only the short bit 
> in the middle, the rest is just a mass of cylinders, spheres and a plane to 
> illustrate what's going on (though be prepared for the rendered image to 
> look a bit messy :-) ).
> 
> The transformation is worked out in two steps. The first bit works out the 
> rotation required to align the Z-axis with the new Z-axis, which I've 
> assumed to be pointing from P1 to P2. The second works out the rotation 
> around the Z-axis to align the Y-axis with an adjusted copy of the new 
> Y-axis (derived from your calculated plane normal). After that you just need 
> to assemble a complete transform (which can also include the translation to 
> P1) and you've got an easy way of transposing stuff from the POV-Ray 
> coordinate system to your new coordinate system.  You can also use the 
> 'inverse' keyword to reverse the transformation if you need to.
> 
> Regards,
> Chris B.
> 
> [code]

hello chris,

excellent example but it is not quite what I wanted. in fact i just 
wanted to "put" this three points in space on the plane {y, 0} for 
"landing" objects.

from your code, I do some modifications and I get what I want.

#declare newY=vnormalize(vcross(p2-p1,p3-p1));
// just convert from rectengular to polar
// angle -> <distance, azimut,height>
#declare angles=r2p(-newY,true);

and i just add this transforms to my object :
object {
  ...
  ...
  rotate -angles.y*y
  rotate -(90-angles.z)*z
  }

of course, 'p1.y' is always zero.


thanks too :)

-- 
klp


Post a reply to this message

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