Hi Alex,
If the cubes displayed are just fine, you could use this:
http://processing.org/reference/modelX_.html. You will be able to map (as it's called here) the coordinates of your original cube to the new place.
In your example, I think that where you have (0,0,0), you could replace the coordinates by the coordinates of your cubes:
Code:
pushMatrix();
//your rotations...
rotateY(1.0); //yrot);
rotateZ(2.0); //zrot);
//Your well displayed quad...
quad(p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y);
//Calculations
float q1.x = modelX(p1.x,p1.y,p1.z);
float q1.y = modelY(p1.x,p1.y,p1.z);
float q1.z = modelZ(p1.x,p1.y,p1.z);
float q2.x = modelX(p2.x,p2.y,p2.z);
float q2.y = modelY(p2.x,p2.y,p2.z);
float q2.z = modelZ(p2.x,p2.y,p2.z);
...
float q3,q4,q5...
popMatrix();
Where p1... are the coordinates of your cube without the transformations.
Where q1... are the coordinates of your cube with the transformation.
---------------------------
Otherwise, the way you describe, by implementing your own set of transformations, this is what we did, and it took us a while to do. You might have a look at http://anar.ch. Maybe this example here is more simple: (http://anar.ch/examples/OOG01cSquare01d.htm). I still have to provide better examples, but you might understand the concept from this applet.
We also have function similar to screenX mapping. (http://anar.ch/examples/Test05c3DPickingConstant.htm). Behind the automatic render in the example, we use a simple function:
Code:
Anar.screenDrawBegin();
pushMatrix();
translate(x,y);
//draw some vertices...
popMatrix();
Anar.screenDrawEnd();
Even if the stuff you draw within this loop is in 3D, the result is 2D planar on a screen plane. This is an attempt to reduce the way you could go from 2d to 3d with better fluidity.
http://anar.ch/doc/anar/Anar.html#orientedDrawBegin(anar.XYZ)
http://anar.ch/doc/anar/Transform.html .(This class works well for complex transformation according to a different referential coordinate system (UVW).) You provide three points, and your transformation is applied according to this coordinate system. This is a first draft of the documentation, but it gives an idea of it works.