POV-Ray : Newsgroups : povray.unofficial.patches : Inverse Transformations patch : Inverse Transformations patch Server Time
2 Sep 2024 06:16:40 EDT (-0400)
  Inverse Transformations patch  
From: Chris Huff
Date: 24 Apr 2000 20:31:17
Message: <chrishuff_99-C97FE1.19341424042000@news.povray.org>
I just finished testing my latest patch, which adds inverse transforms 
to objects, textures, and anything else that can take a transform. The 
syntax is very simple, just add "inverse" in the transform {} block.

#declare Trans =
transform {
    ...
}
#declare InvTrans =
transform {Trans inverse}
Applying "transform Trans" will transform something, applying "transform 
InvTrans" will "undo" those transforms.

I added the patch in the MegaPOV 0.4 code, it only requires modifying 
the function "Parse_Transform" in parse.c.

TRANSFORM *Parse_Transform ()
{
...

   VECTOR Local_Vector;
+   int isInverse = FALSE;

   EXPECT
+     CASE(INVERSE_TOKEN)
+       isInverse = TRUE;
+     END_CASE

...

   Parse_End ();
+   if(isInverse == TRUE)
+   {
+       MInvers(New->matrix, New->matrix);
+       MInvers(New->inverse, New->inverse);
+   }
   return (New);


This brings up the next issue: this requires that the transformation be 
declared before inverse can be used. I think transform {...} blocks 
should be allowed within objects, so you could use:

object {
    transform {
        blah, blah
    }
}
instead of this:

#declare Trans =
transform {
    blah, blah
}
object {
    transform Trans
}

And of course, you should be able to "concatenate" transforms with 
multiple transform {...} blocks. I will be working on this to see how 
hard it will be to implement.

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/


Post a reply to this message

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