|
![](/i/fill.gif) |
Hello
I'm trying to make some macros to enable me to
experiment with different rotation matrix's. (That I
later will apply to 3D vectors to get the desired
rotation of the vector.)
I know about the built in rotate functions in POV-Ray.
I just want to learn about rotation matrix's.
Each matrix is built up as an array of 3 3D-vectors
each. And my macros again operate on these arrays.
My problem is that I get several different error
messages when I try to Run the file below in this
message (I did not alter it between the Runs).
Can anyone please tell me if I am doing anything wrong
in my macros? (variable passing, variable declarations,
variable name conflicts etc.)
I am using POV-Ray v3.1g.watcom.win32 (Pentium II
optimized) and I am using a 100 MHz Pentium PC with
32 MB RAM, running Windows 98.
Regards
Tor Olav
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
Here is some of the error messages:
Warning Stream to console.......On
#local PP = array[3]
#local QQ = array[3]
#local PP = Mtrans(NN)
#local NN <----ERROR
C:\My documents\POVray-bilder\Matrix03_.inc:39: error: undeclared
identifier expected but float function 'clock_delta' found instead.
Warning Stream to console.......On
#local PP = array[3]
#local QQ = array[3]
#local PP = Mtrans(NN)
#local NN <----ERROR
C:\My documents\POVray-bilder\Matrix03_.inc:39: error: undeclared
identifier expected but float function 'tan' found instead.
Warning Stream to console.......On
#local PP = array[3]
#local QQ = array[3]
#local PP = Mtrans(NN)
#local NN <----ERROR
C:\My documents\POVray-bilder\Matrix03_.inc:39: error: undeclared
identifier expected but float function 'on' found instead.
Warning Stream to console.......On
#local PP = array[3]
#local QQ = array[3]
#local PP = Mtrans(NN)
#local NN <----ERROR
C:\My documents\POVray-bilder\Matrix03_.inc:39: error: undeclared
identifier expected but float function 'abs' found instead.
Warning Stream to console.......On
#local PP = array[3]
#local QQ = array[3]
#local PP = Mtrans(NN)
#local NN <----ERROR
C:\My documents\POVray-bilder\Matrix03_.inc:39: error: undeclared
identifier expected but float function found instead.
Warning Stream to console.......On
#)
#local PP = array[3]
#local QQ = array[3]
#local PP = Mtrans(NN <----ERROR
C:\My documents\POVray-bilder\Matrix03_.inc:54: error: Cannot pass
uninitialized identifier as macro parameter.
Initialize first.
Warning Stream to console.......On
#local QQ = array[3]
#local PP = Mtrans(NN)
#local NN = array[3]
#local NN[0] = <MM[0] <----ERROR
C:\My documents\POVray-bilder\Matrix03_.inc:40: error: Attempt to access
uninitialized array element.
Here is the POV-file that generates the errors:
// =============================================================
//
// Copyright 2000 by Tor Olav Kristensen
//
// =============================================================
#macro S3Prod(U, V, W)
vdot(U, vcross(V, W))
#end
#macro Mcof(MM)
#local NN = array[3]
#local NN[0] = vcross(MM[1], MM[2]);
#local NN[1] = vcross(MM[2], MM[0]);
#local NN[2] = vcross(MM[0], MM[1]);
NN
#end
#macro Mdet(MM)
S3Prod(MM[0], MM[1], MM[2])
#end
#macro Mtrans(MM)
#local NN = array[3]
#local NN[0] = <MM[0].x, MM[1].x, MM[2].x>;
#local NN[1] = <MM[0].y, MM[1].y, MM[2].y>;
#local NN[2] = <MM[0].z, MM[1].z, MM[2].z>;
NN
#end
#macro Mmult(MM, NN)
#local PP = array[3]
#local QQ = array[3]
#local PP = Mtrans(NN)
#local QQ[0] = <vdot(MM[0], PP[0]), vdot(MM[0], PP[1]), vdot(MM[0],
PP[2])>;
#local QQ[1] = <vdot(MM[1], PP[0]), vdot(MM[1], PP[1]), vdot(MM[1],
PP[2])>;
#local QQ[2] = <vdot(MM[2], PP[0]), vdot(MM[2], PP[1]), vdot(MM[2],
PP[2])>;
QQ
#end
#macro Mscale(s, MM)
#local NN = array[3]
#local NN[0] = s*MM[0];
#local NN[1] = s*MM[1];
#local NN[2] = s*MM[2];
MM
#end
#macro Minv(MM)
#local NN = array[3]
#local PP = array[3]
#local QQ = array[3]
#local s = 1/Mdet(MM);
#local NN = Mcof(MM)
#local PP = Mtrans(NN)
#local QQ = Mscale(s, PP)
QQ
#end
#declare MMi =
array[3] {
< 2, 0, 6>,
< 8, 1, -4>,
< 0, 5, 7>
}
#declare QQi = array[3]
#declare QQi = Minv(MMi)
#declare RRi = array[3]
#declare RRi = Mmult(MMi, Minv(MMi))
Post a reply to this message
|
![](/i/fill.gif) |