POV-Ray : Newsgroups : povray.general : Transformation Quiz : Re: Transformation Quiz Server Time
2 Aug 2024 08:12:16 EDT (-0400)
  Re: Transformation Quiz  
From: Mike Williams
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.