POV-Ray : Newsgroups : povray.windows : Local Transformations : Re: Local Transformations Server Time
28 Jul 2024 18:19:10 EDT (-0400)
  Re: Local Transformations  
From: Ronald L  Parker
Date: 7 Jan 1999 21:02:04
Message: <3695579f.203733540@news.povray.org>
On Thu, 07 Jan 1999 15:42:09 -0800, Tony Vigil <tvi### [at] emc-inccom>
wrote:

>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?

Well, the macro only does the inverse of a rotation.  It's not a
general solution to anything.  But let's try anyway, shall we?

Now, the principle is to do all the local transforms, then all the
global ones.  There aren't any global ones, so all we have are the
local ones:

rotate 45*y
// now the object is at 0,0,0 rotated 45 degrees around the Y axis.

translate x
// now at 1,0,0, rotated 45*y

rotate -90*y
// now at 0,0,-1, rotated -45*y

translate z
// now at 0,0,0, rotated -45*y

rotate 45*y
// now at 0,0,0, rotated 0.

Guess it works.  But I'm gonna have to modify my earlier statement a
bit: this principle only works if you have a series of global
transformations, followed by a series of local transformations.  

Let's prove Exercise 2 from last time for this restricted principle. 

First, a note about notation:  Transforms whose names start with L are
to be applied locally, and the ones that start with G are to be
applied globally.  A symbol of the form LiG will be used to represent
a transform that was originally supposed to have been applied locally,
should now be applied globally, but is in every other respect
identical to the original transform Li.  We'll denote the inverse of
G1 as G1', since we don't have any superscripts in plain text.  

Suppose you have a sequence of transforms 
(G1 G2 ... Gn L1 L2 ... Lm)  
It's clear, but again left as an exercise to the reader, that to
perform a single local operation after performing a series of global
operations, you must merely undo all of the global operations, then do
the single local operation, then do the global operations again.  Then
we have that Li as a global transform is 
(Gn' ... G2' G1') LiG (G1 G2 ... Gn) 

So we rewrite with all global transforms:
(G1 G2 ... Gn) (Gn' ... G2' G1') L1G (G1 G2 ... Gn) (Gn' ... G2' G1')
L2G (G1 G2 ... Gn) ... (Gn' ... G2' G1') LmG (G1 G2 ... Gn) 

Now you see that the subsequences (G1 G2 ... Gn) (Gn' ... G2' G1') 
cancel out, so we are left with L1G L2G ... LmG G1 G2 ... Gn, and all
are global transforms.  This is the desired result.

If you have a mixture of global and local transforms in arbitrary
order, you need to be a little more careful.  To resolve the sequence 
(G1 G2 L1 L2 G3 L3) into all global transforms, we have to do this:

the subsequence (G1 G2 L1 L2) resolves, by the previously stated
principle, to the equivalent sequence of global transforms 
(L1G L2G G1 G2).  Putting it back into the original sequence, we now
have (L1G L2G G1 G2 G3 L3).  Now we have a series of global
transforms, followed by a local transform, so we can reorder and get 
(L3G L1G L2G G1 G2 G3).  Notice that the formerly local transforms at
the beginning are not in the obvious order.  This is important.

EXERCISES

1. Prove that to perform a transform locally, you can undo all of the
   global transformations leading up to the current location, then do
   the 'local' transform, then redo the global transformations.

2. (Extra Credit) Find out who Thorsten Froelich is.  See if you can
   determine why everyone's laughing about your telling him to reread
   the documentation.


Post a reply to this message

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