|
![](/i/fill.gif) |
clipka <ano### [at] anonymous org> wrote:
> If you need to apply the inverse transform, you can also use:
>
> #declare MyInvTransform = transform { MyTransform inverse }
Hi,
this was the keyword :-)
Now it is working!
In the past I've experimented with vtransform, vinv_transform and some other
functions, but got no working code. The transform with the 'inverse' keyword was
working immediately.
Now I could reduce the parsing time from 57 to 33 seconds.
Thanks a lot to all!
------------
for intrests, here is the code doing the back-traansformation:
fAnimCnt,arAnimTrans and arAnimVek are initialisized by revious function calls.
fAnimCnt stores the number of transforms in the arrays.
arAnimTrans[] is the type of transformation, 1=translate, 2=rotate
arAnimVek[] stores the vector values of the transform
arVertics is an array with the vertics of the mesh (not in vetor format -
array[Num][3] to be compatible with my older macros)
// build the transform-statement
#local i=0;
#local vtrans = transform {
#while (i<fAnimCnt)
#if (arAnimTrans[i]=1) // translate
translate arAnimVek[i]
#else
rotate arAnimVek[i] // rotate
#end
#local i=i+1;
#end
}
// the inverse transformation
#local itrans=transform{vtrans inverse};
// applying the transform to all vertics
#local Size=dimension_size(arVertics,1);
#local i=0;
#while (i<Size)
#local V=<arVertics[i][0],arVertics[i][1],arVertics[i][2]>;
#local V=vtransform(V,itrans);
#declare arVertics[i][0]=V.x;
#declare arVertics[i][1]=V.y;
#declare arVertics[i][2]=V.z;
#local i=i+1;
#end
Post a reply to this message
|
![](/i/fill.gif) |