POV-Ray : Newsgroups : povray.windows : Local Transformations Server Time
28 Jul 2024 18:12:20 EDT (-0400)
  Local Transformations (Message 2 to 11 of 21)  
<<< Previous 1 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Ronald L  Parker
Subject: Re: Local Transformations
Date: 6 Jan 1999 23:22:53
Message: <36963665.129679744@news.povray.org>
On Wed, 06 Jan 1999 16:56:08 -0800, Tony Vigil <tvi### [at] emc-inccom>
wrote:

>Is there any way to do local transformations based on an object's
>current scale, position & rotation?  (i.e. a translation on an object's
>X axis as apposed to the origin's X axis)
>
>If there isn't currently a way to do this, is there enough interest for
>someone to create a patch?

Maybe I'm an idiot, but if you can't just put the translate along the
X axis in before whatever transformation moved it to the new position,
how is the software going to know what you thought the X axis was?


Post a reply to this message

From: Bob Hughes
Subject: Re: Local Transformations
Date: 7 Jan 1999 01:35:16
Message: <369455AE.B8977B3B@aol.com>
You're hardly an idiot.

"Ronald L. Parker" wrote:
> 
> On Wed, 06 Jan 1999 16:56:08 -0800, Tony Vigil <tvi### [at] emc-inccom>
> wrote:
> 
> >Is there any way to do local transformations based on an object's
> >current scale, position & rotation?  (i.e. a translation on an object's
> >X axis as apposed to the origin's X axis)
> >
> >If there isn't currently a way to do this, is there enough interest for
> >someone to create a patch?
> 
> Maybe I'm an idiot, but if you can't just put the translate along the
> X axis in before whatever transformation moved it to the new position,
> how is the software going to know what you thought the X axis was?

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/POVring.htm
=Bob


Post a reply to this message


Attachments:
Download 'us-ascii' (1 KB)

From: Tony Vigil
Subject: Re: Local Transformations
Date: 7 Jan 1999 14:54:46
Message: <369512B3.B9F1079D@emc-inc.com>
Maybe I am missing something.

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

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>

Bob Hughes wrote:

> You're hardly an idiot.
>
> "Ronald L. Parker" wrote:
> >
> > On Wed, 06 Jan 1999 16:56:08 -0800, Tony Vigil <tvi### [at] emc-inccom>
> > wrote:
> >
> > >Is there any way to do local transformations based on an object's
> > >current scale, position & rotation?  (i.e. a translation on an object's
> > >X axis as apposed to the origin's X axis)
> > >
> > >If there isn't currently a way to do this, is there enough interest for
> > >someone to create a patch?
> >
> > Maybe I'm an idiot, but if you can't just put the translate along the
> > X axis in before whatever transformation moved it to the new position,
> > how is the software going to know what you thought the X axis was?
>
> --
>  omniVERSE: beyond the universe
>   http://members.aol.com/inversez/POVring.htm
> =Bob


Post a reply to this message


Attachments:
Download 'us-ascii' (2 KB)

From: Tony Vigil
Subject: Re: Local Transformations
Date: 7 Jan 1999 14:56:00
Message: <36951301.61FF93C8@emc-inc.com>
If VRML can do it, why not POV???

"Ronald L. Parker" wrote:

> On Wed, 06 Jan 1999 16:56:08 -0800, Tony Vigil <tvi### [at] emc-inccom>
> wrote:
>
> >Is there any way to do local transformations based on an object's
> >current scale, position & rotation?  (i.e. a translation on an object's
> >X axis as apposed to the origin's X axis)
> >
> >If there isn't currently a way to do this, is there enough interest for
> >someone to create a patch?
>
> Maybe I'm an idiot, but if you can't just put the translate along the
> X axis in before whatever transformation moved it to the new position,
> how is the software going to know what you thought the X axis was?


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Local Transformations
Date: 7 Jan 1999 15:43:39
Message: <36951c7b.0@news.povray.org>
In article <369512B3.B9F1079D@emc-inc.com> , Tony Vigil <tvi### [at] emc-inccom>  wrote:

>Maybe I am missing something.

No, you aren't missing something, you just did not read the docs! See section
4.3.1.3.

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

So your code would look like:
rotate <0,45,0>
translate <1,0,0>

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

Did you consider (after reading the docs) to write:
translate <1,0,0>
rotate <0,45,0>

It will do what you want - and reading the docs will surely show you some other
features you don't even know about! :-)


    Thorsten


Post a reply to this message

From: Ron Parker
Subject: Re: Local Transformations
Date: 7 Jan 1999 15:50:14
Message: <36951e06.0@news.povray.org>
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

From: Tony Vigil
Subject: Re: Local Transformations
Date: 7 Jan 1999 18:24:14
Message: <369543CF.A44A2BFF@emc-inc.com>
Thorsten Froehlich wrote:

> No, you aren't missing something, you just did not read the docs! See section
> 4.3.1.3.

I sure did read them.  You have misread them.  Rotations are relative to the object
axis
& translations/scaling are relative to the origin.

>
> >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>???
>
> So your code would look like:
> rotate <0,45,0>
> translate <1,0,0>
>

Your code places the object at <1,0,0>.  If POV did have a local coordinate system for
each object, those same transformations would put it at < 0.71, 0,  -0.71>.


>
> >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>
>
> Did you consider (after reading the docs) to write:
> translate <1,0,0>
> rotate <0,45,0>
>

I sure did.  Now suppose you want to perform another set of transfomations to the same
object:

-45 degrees on the object's Y axis (no translations occuring), then translate 1 unit
along the object's Z axis.  Now what???  The object should be at in it's original
rotational state of <0,0,0> located at <0.71 , 0 , 0.29> - but it's not.


> It will do what you want - and reading the docs will surely show you some other
> features you don't even know about! :-)
>
>     Thorsten

Thanks for the reading tip though.  Perhaps you should do likewise. :-)

Tony


Post a reply to this message

From: Tony Vigil
Subject: Re: Local Transformations
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

From: Julius Klatte
Subject: Re: Local Transformations
Date: 7 Jan 1999 19:15:13
Message: <36954e11.0@news.povray.org>
What you need to do is FIRST translate the object so its position 
becomes <1,0,0> and THEN rotate it around the y-axis. (Of course you can 
also first rotate and then translate the object using 
translate <translation along 'own x-axis'*cos(radians(rotation around 
y)),0,translation sin(radians(rotation around y))> (which for 45 deg 
would come to <0.71,0,0.71>) but that's a little more complicated.

Julius

http://surf.to/jkhome
United Artists Galleries: http://surf.to/uagalleries
Maybe I am missing something. 
    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>??? 
    
    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> 
    
    Bob Hughes wrote: 
    
    You're hardly an idiot. 
        "Ronald L. Parker" wrote: 
        > 
        > On Wed, 06 Jan 1999 16:56:08 -0800, Tony Vigil 
<tvi### [at] emc-inccom> 
        > wrote: 
        > 
        > >Is there any way to do local transformations based on an 
object's 
        > >current scale, position & rotation?  (i.e. a translation on 
an object's 
        > >X axis as apposed to the origin's X axis) 
        > > 
        > >If there isn't currently a way to do this, is there enough 
interest for 
        > >someone to create a patch? 
        > 
        > Maybe I'm an idiot, but if you can't just put the translate 
along the 
        > X axis in before whatever transformation moved it to the new 
position, 
        > how is the software going to know what you thought the X axis 
was? 
        
        -- 
         omniVERSE: beyond the universe 
          http://members.aol.com/inversez/POVring.htm 
        =Bob


Post a reply to this message


Attachments:
Download 'iso-8859-1' (3 KB)

From: Ronald L  Parker
Subject: Re: Local Transformations
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

<<< Previous 1 Messages Goto Latest 10 Messages Next 10 Messages >>>

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