I started implementing some remaining functions for the PMatrix3D object in Processing.js. I guess you can say I’m not entirely enjoying the process of digging through Processing code, throwing in calls to create matrices and getting Processing to spit out the values so I can compare against Pjs. I just scratched the surface and It’s taking about forever with all the files I have open and building and running and copying and pasting…. 😦 To keep myself sane, I’ve been working on some really sweet 3D stuff in C3DL…but I’m showing anything till I’m done. teehee…. Instead of a screenshot or demo, here is something much more exciting: The PMatrix3D tests I have written so far…
var p = new PMatrix3D();
///////////////////
// SKEWX
//////////////////
p.skewX(0.0);
_checkEqual(
[ 1.0000, 0.0000, 0.0000, 0.0000,
0.0000, 1.0000, 0.0000, 0.0000,
0.0000, 0.0000, 1.0000, 0.0000,
0.0000, 0.0000, 0.0000, 1.0000
], p.array() );
p.reset();
p.skewX( 3.14 );
_checkEqual(
[1.0000, -0.0015926549364072232, 0.0000, 0.0000,
0.0000, 1.0000, 0.0000, 0.0000,
0.0000, 0.0000, 1.0000, 0.0000,
0.0000, 0.0000, 0.0000, 1.0000],
p.array() );
p.reset();
p.skewX(-3.14);
_checkEqual(
[1.0000, 0.0015926549364072232, 0.0000, 0.0000,
0.0000, 1.0000, 0.0000, 0.0000,
0.0000, 0.0000, 1.0000, 0.0000,
0.0000, 0.0000, 0.0000, 1.0000],
p.array());
p.reset();
p.set(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4);
p.skewX(0.0);
_checkEqual(
[1.0000, 2.0000, 3.0000, 4.0000,
1.0000, 2.0000, 3.0000, 4.0000,
1.0000, 2.0000, 3.0000, 4.0000,
1.0000, 2.0000, 3.0000, 4.0000],
p.array());
p.reset();
p.set(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4);
p.skewX(-1.0);
_checkEqual(
[1.0000, 0.44259227534509793, 3.0000, 4.0000,
1.0000, 0.44259227534509793, 3.0000, 4.0000,
1.0000, 0.44259227534509793, 3.0000, 4.0000,
1.0000, 0.44259227534509793, 3.0000, 4.0000],
p.array());
///////////////////
// SKEWY
//////////////////
p.reset();
p.skewY(0.0);
_checkEqual(
[ 1.0000, 0.0000, 0.0000, 0.0000,
0.0000, 1.0000, 0.0000, 0.0000,
0.0000, 0.0000, 1.0000, 0.0000,
0.0000, 0.0000, 0.0000, 1.0000
], p.array() );
p.reset();
p.skewY( 3.14 );
_checkEqual(
[1.0000, 0.0000, 0.0000, 0.0000,
-0.0015926549364072232, 1.0000, 0.0000, 0.0000,
0.0000, 0.0000, 1.0000, 0.0000,
0.0000, 0.0000, 0.0000, 1.0000],
p.array() );
p.reset();
p.skewY( -3.14 );
_checkEqual(
[1.0000, 0.0000, 0.0000, 0.0000,
0.0015926549364072232, 1.0000, 0.0000, 0.0000,
0.0000, 0.0000, 1.0000, 0.0000,
0.0000, 0.0000, 0.0000, 1.0000],
p.array() );
p.reset();
p.set(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4);
p.skewY( 0.0 );
_checkEqual(
[1.0000, 2.0000, 3.0000, 4.0000,
1.0000, 2.0000, 3.0000, 4.0000,
1.0000, 2.0000, 3.0000, 4.0000,
1.0000, 2.0000, 3.0000, 4.0000],
p.array() );
p.reset();
p.set(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4);
p.skewY( -1.0 );
_checkEqual(
[-2.114815449309804, 2.0000, 3.0000, 4.0000,
-2.114815449309804, 2.0000, 3.0000, 4.0000,
-2.114815449309804, 2.0000, 3.0000, 4.0000,
-2.114815449309804, 2.0000, 3.0000, 4.0000],
p.array() );
p.reset();
p.set(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4);
p.skewY( -3.14 );
_checkEqual(
[1.0031853098728145, 2.0000, 3.0000, 4.0000,
1.0031853098728145, 2.0000, 3.0000, 4.0000,
1.0031853098728145, 2.0000, 3.0000, 4.0000,
1.0031853098728145, 2.0000, 3.0000, 4.0000],
p.array() );
p.reset();
p.set(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4);
p.skewY( 3.14 );
_checkEqual(
[0.9968146901271856, 2.0000, 3.0000, 4.0000,
0.9968146901271856, 2.0000, 3.0000, 4.0000,
0.9968146901271856, 2.0000, 3.0000, 4.0000,
0.9968146901271856, 2.0000, 3.0000, 4.0000],
p.array() );
All tests pass so far, but this is about the most boring and tedious thing I’ve ever had to write.