POV-Ray : Newsgroups : povray.general : Transformation Quiz Server Time
1 Nov 2024 09:19:01 EDT (-0400)
  Transformation Quiz (Message 1 to 3 of 3)  
From: ShiJie
Subject: Transformation Quiz
Date: 23 Nov 2004 10:50:01
Message: <web.41a35b12a2f105e5174727610@news.povray.org>
Dear NG,

I wanted to learn more about transformations like rotation and etc. There
must be a reference point for each. For things like translate, I guess it
does not matter.. but for rotate? is the reference the x,y and z axis? I
first thought that reference point were calculated using the centroid of
the object being translated.



And another question is regarding rotation. I think there is a certain
function called v_rotation (or something similar) in which I can define the
rotation axis, but.. this seems to only rotate a point. Is there a certain
function that could define the rotation axis of any object?

I want something similar to Lathe (but Lathe 1. rotates splines and curves
2. rotates them with almost infinite copies) but in which objects are
rotated but with small number of copies (say 5 copies in a 360 degree angle
rotation). Any advise would be appreciated.

Sincerely,
Jose Capco


Post a reply to this message

From: Rarius
Subject: Re: Transformation Quiz
Date: 23 Nov 2004 12:19:32
Message: <41a37124$1@news.povray.org>
Regarding transformations...

All transformations act around the origin. It is a good practice to build 
your objects based on the origin, rotate them and then translate them to 
their final position. For example:

cylinder
{
    <0, 0, 0>, <0, 0, 10>, 1
    rotate<45, 0, 0>                //orient
    translate<20, 30, 50>        //move to final position
}

The rotate transformation acts as you suggest... It first applies a rotation 
around the x-axis, then the y-axis then the z-axis. This can be very useful 
if you want to create a ring of objects... Which is what I think you are 
asking for...

#local n=0;
#while(n<360)
    cylinder
    {
        <10, 0, 0>, <10, 0, 10>, 1    //Note that the cylinder isn't at the 
origin!
        rotate<0, 0, n>                    //rotate around the origin....
    }
    #local n=n+30;
#end

The only way to rotate an object about an arbitrary axis is to start playing 
with the matrix transformations... Which I am not qualified to explain!

Rarius

"ShiJie" <jca### [at] yahoocom> wrote in message 
news:web.41a35b12a2f105e5174727610@news.povray.org...
> Dear NG,
>
> I wanted to learn more about transformations like rotation and etc. There
> must be a reference point for each. For things like translate, I guess it
> does not matter.. but for rotate? is the reference the x,y and z axis? I
> first thought that reference point were calculated using the centroid of
> the object being translated.
>
>
>
> And another question is regarding rotation. I think there is a certain
> function called v_rotation (or something similar) in which I can define 
> the
> rotation axis, but.. this seems to only rotate a point. Is there a certain
> function that could define the rotation axis of any object?
>
> I want something similar to Lathe (but Lathe 1. rotates splines and curves
> 2. rotates them with almost infinite copies) but in which objects are
> rotated but with small number of copies (say 5 copies in a 360 degree 
> angle
> rotation). Any advise would be appreciated.
>
> Sincerely,
> Jose Capco
>
>


Post a reply to this message

From: Mike Williams
Subject: Re: Transformation Quiz
Date: 23 Nov 2004 13:27:33
Message: <Ev3SkEABE4oBFw94@econym.demon.co.uk>
Wasn't it ShiJie who wrote:
>Dear NG,
>
>I wanted to learn more about transformations like rotation and etc. There
>must be a reference point for each. For things like translate, I guess it
>does not matter.. but for rotate? is the reference the x,y and z axis? I
>first thought that reference point were calculated using the centroid of
>the object being translated.

Unlike certain modelling programs, POV doesn't rotate objects about
their centroid, it rotates them about the point <0,0,0>.

>And another question is regarding rotation. I think there is a certain
>function called v_rotation (or something similar) in which I can define the
>rotation axis, but.. this seems to only rotate a point. Is there a certain
>function that could define the rotation axis of any object?

As you say, vrotate and vaxis_rotate only rotate a single point.

There's a number of macros in transforms.inc that add other types of
rotation. They all create a transform (which can be a combination of
rotation, translation, scaling, shearing etc.) which can be applied to
an object.

You use them like:

  #include "transforms.inc"

  object {MyObject
    transform {Axis_Rotate_Trans(<3,1,2>,45)}
  }

>I want something similar to Lathe (but Lathe 1. rotates splines and curves
>2. rotates them with almost infinite copies) but in which objects are
>rotated but with small number of copies (say 5 copies in a 360 degree angle
>rotation). Any advise would be appreciated.

It may well be easier to move your object from wherever it is to your
required radius from the origin, perform your rotation there, then move
the ring of objects into the final position. Something like this:

#declare MyObject = ...

// Size of the ring of objects
#declare Radius=2;

// Find the current centre of MyObject
#declare Centre=(min_extent(MyObject)+max_extent(MyObject))/2;

// Create a ring of five objects around the origin in the x-z plane
#declare Ring = union {
  #declare Angle=0;
  #while (Angle<360)
    object {MyObject
      translate -Centre   // move it to the origin
      translate x*Radius  // move to circumference
      rotate y*Angle      // perform the rotation
    }
    #declare Angle = Angle + 360/5; // Five copies in 360 degrees
  #end
}

// Position the ring where it is needed
object {Ring rotate x*45 translate y}



-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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