POV-Ray : Newsgroups : povray.windows : Local Transformations : Re: Local Transformations Server Time
28 Jul 2024 12:35:20 EDT (-0400)
  Re: Local Transformations  
From: Tony Vigil
Date: 7 Jan 1999 18:34:58
Message: <36954651.8533734C@emc-inc.com>
Thank you mucho for your macro.

Hypothetically, what if you needed to do the following:

Create an object at <0,0,0>
Rotate the object 45 degrees * around the object's Y axis
Translate the object 1 unit along object's X axis (now at a 45 degree angle)
Rotate the object -90 degrees * around the object's Y axis
Translate the object 1 unit along the object's Z axis (now at a -45 degree angle)
Rotate the object 45 degrees * around the object's Y axis


Will your macro place the object at <0,0,0> with 0 rotation on each axis?

Mucho thanks!

Tony

Ron Parker wrote:

> On Thu, 07 Jan 1999 12:01:55 -0800, Tony Vigil <tvi### [at] emc-inccom> wrote:
> >Maybe I am missing something.
>
> In that case, please allow me to elucidate.
>
> >If you have an object that is positioned at <0,0,0> and is rotated 45 degrees
> >on the Y axis, then translate it 1 unit on the X axis, won't it be located at
> ><1,0,0>???
>
> Yes it will.  That's not what I was trying to say.
>
> >What I was wanting to do is translate that same object (with it's rotated
> >axis), 1 unit on it's own X axis.
> >
> >The approximate coordinates would become < 0.71, 0,  0.71> instead of <1,0,0>
>
> All you have to do is translate first, then rotate:
>
>     sphere {
>       0, 1
>
>       /* local transformations */
>       translate x
>
>       /* global transformations */
>       rotate 45*y
>     }
>
> makes a sphere with its center at <sqrt(.5),0,sqrt(.5)>, just as requested.
> This works for more complex objects and transformations, too, but the proof
> is left as an exercise for the reader. (See Exercise 2.)
>
> This assumes you're actually doing the rotation, of course.  If you're not,
> (for example, you're using a mesh exported from Poser) then there's no way
> for you or POV to know what "its own X axis" is.  If you're not doing the
> rotation, but you know something about the rotation and can supply the
> necessary parameters in the form of a rotation vector, then what you need
> to do is:
>
>     #macro InvRotate( Rot )
>       transform {
>         rotate -Rot.z*z
>         rotate -Rot.y*y
>         rotate -Rot.x*x
>       }
>     #end
>
>     object {
>       MyObject
>
>       #declare Rot=<whatever your rotation vector is>;
>       InvRotate( Rot )
>       translate x
>       rotate Rot
>     }
>
> (Note the three rotates to form the inverse: this is because POV always
> rotates along X first, then Y, then Z.  The inverse should go in the
> opposite direction.)
>
> The same goes for any other transformation: if it's one you did yourself, just
> do the "local" transformations first, before you apply the "global" ones.  If
> it's not, you have to "back out" the pre-applied "global" transformations,
> then apply the "local" ones, then apply the "global" ones again.  I am
> hard-pressed to think of a specification syntax that would make this much
> easier than it already is.
>
> EXERCISES:
>
> 1. Discover a method to turn off the HTML "feature" in your news posting
>    software.  Use it.
>
> 2. Prove that the method given works for more complex objects and transforms.
>
> 3. (Extra Credit) Write a short paragraph on the properties of a trivial
>    bijective mapping between the sets (she's, he's, it's) and (her, his, its)
>
> 4. (Extra Credit) The First Law of Usenet claims that every spelling flame
>    will contain at least one misspelled word or factual error.  Find one in
>    this post.


Post a reply to this message

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