POV-Ray : Newsgroups : povray.general : Position after rotation : Re: Position after rotation Server Time
6 Oct 2024 09:03:32 EDT (-0400)
  Re: Position after rotation  
From: eticre
Date: 23 Apr 2014 12:50:00
Message: <web.5357eeb1263e54cc16580fae0@news.povray.org>
"pbrants" <pbr### [at] telenetbe> wrote:
> Where can I retrieve the new position after a rotation (or transformation in
> general) of a point (let's say a center of a sphere or box) when I need that for
> future references or calculations?
>
> Paul

Hi I use this formula for retrieve the end point of a segment with 0-0-0 origin
leght=3,5 and rotation xrot-yrot-zrot

//rot x-y
#declare yt = 3.5* ( cos( radians(xrot) ) );
#declare xt = 3.5* ( sin( radians(yrot) ) * sin(radians(xrot) ) );
#declare zt = 3.5* ( cos( radians(yrot) ) * sin(radians(xrot) ) );

//rot xyz
#local yt1 = xt*sin( radians(zrot) ) + yt*cos( radians(zrot) ) ;
#local xt1 = xt*cos( radians(zrot) ) - yt*sin( radians(zrot) ) ;

//edge point
translate <xt1,yt1,zt>


Post a reply to this message

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