POV-Ray : Newsgroups : povray.windows : Local Transformations Server Time
24 Nov 2024 15:37:37 EST (-0500)
  Local Transformations (Message 1 to 10 of 21)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Tony Vigil
Subject: Local Transformations
Date: 6 Jan 1999 19:48:59
Message: <36940628.ABB48441@emc-inc.com>
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?


Post a reply to this message

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)

Goto Latest 10 Messages Next 10 Messages >>>

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