|
 |
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] yahoo com
TAG(Technical Assistance Group) e-mail: chr### [at] tag povray org
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/
Post a reply to this message
|
 |