POV-Ray : Newsgroups : povray.windows : Local Transformations : Re: Local Transformations Server Time
28 Jul 2024 18:24:13 EDT (-0400)
  Re: Local Transformations  
From: Ron Parker
Date: 8 Jan 1999 10:32:17
Message: <36962501.0@news.povray.org>
On 8 Jan 1999 09:53:08 -0500, Ron Parker <par### [at] my-dejanewscom> wrote:
>On Thu, 07 Jan 1999 19:16:50 -0800, Tony Vigil <tvi### [at] emc-inccom> wrote:
>>Ronald,
>>
>>Thank you very much for your in-depth lesson on tranformation sequences!  This is
>>basically what I thought I would have to do, but didn't want to.  It would be so
much
>>less convoluted if we could just use local coordinate systems.
>
>Perhaps.  One way to do so, I would think, is to have a set of macros to do 
>global transformations that has the side-effect of storing the current 
>transformation matrix into an array. 
...
>Of course, as you say, a patch to do this (or at least a patch to retrieve 
>the current transformation matrix for an object into an array) would be quite 
>useful.

I just had a great idea that wouldn't require a patch and would be fairly 
painless, except that it doesn't work due to what appears to be a bug in 
POV-Ray. (It doesn't allow you to put transform identifiers in a transform
declaration unless they're the only thing in the declaration, contrary to
the documentation.)

#macro trans_rotate( trans, rot, islocal )
  #declare trans=transform {
     #if (islocal) rotate rot #end
     transform{trans}
     #if (!islocal) rotate rot #end
  }
#end

#macro trans_scale( trans, scl, islocal )
  #declare trans=transform {
     #if (islocal) scale scl #end
     transform{trans}
     #if (!islocal) scale scl #end
  }
#end

#macro trans_translate( trans, tr, islocal )
  #declare trans=transform {
     #if (islocal) translate tr #end
     transform{trans}
     #if (!islocal) translate tr #end
  }
#end

#declare My_trans=transform{ scale 1 } // identity matrix
trans_rotate( My_trans, 45*y, no ) // global rotate
trans_translate( My_trans, x, yes ) // local translate
...


Post a reply to this message

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