POV-Ray : Newsgroups : povray.general : Position after rotation Server Time
25 Nov 2024 12:38:56 EST (-0500)
  Position after rotation (Message 1 to 6 of 6)  
From: pbrants
Subject: Position after rotation
Date: 11 Apr 2014 17:10:00
Message: <web.53485932432fd1004e8159130@news.povray.org>
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


Post a reply to this message

From: Le Forgeron
Subject: Re: Position after rotation
Date: 12 Apr 2014 03:07:24
Message: <5348e62c$1@news.povray.org>
Le 11/04/2014 23:05, pbrants nous fit lire :
> 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
> 
> 
use vtransform from transforms.inc.

 vtransform(vec, trans)

See also:

> http://wiki.povray.org/content/Documentation:Tutorial_Section_2.2#Transformations

and

> http://wiki.povray.org/content/Reference:Transforms.inc


Post a reply to this message

From: Samuel Benge
Subject: Re: Position after rotation
Date: 12 Apr 2014 13:00:00
Message: <web.53496ffe263e54cc2953d4f90@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?

Hi Paul,

min_extent() & max_extent() will give you the bounding box of an object, and
with that info you can find its center.

You can also use vrotate() to rotate a vector. For every transformation you give
your object, transform a vector. This is useful whenever min_extent() &
max_extent() won't give you accurate results (which can happen if you've used a
lot of CSG), or if you want to keep track of say, a specific corner of a box.

Sam


Post a reply to this message

From: pbrants
Subject: Re: Position after rotation
Date: 12 Apr 2014 16:50:00
Message: <web.5349a6ad263e54cc4e8159130@news.povray.org>
Thanks for the suggestions! I think I can figure it out now.

Paul


Post a reply to this message

From: Alain
Subject: Re: Position after rotation
Date: 12 Apr 2014 22:19:24
Message: <5349f42c$1@news.povray.org>

> Thanks for the suggestions! I think I can figure it out now.
>
> Paul
>
>
>
Also, for the translate: Just add the translation vector to your 
location vector.


Alain


Post a reply to this message

From: eticre
Subject: Re: Position after rotation
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.