We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › 3D Calculations without the 3D Renderer
Page Index Toggle Pages: 1
3D Calculations without the 3D Renderer (Read 958 times)
3D Calculations without the 3D Renderer
Mar 26th, 2010, 9:28am
 
The processing idiom for doing this eludes me: I want to create several 3d points (i.e. vectors), rotate them about arbitrary axes, scale them, and then get their X, Y, and Z coordinates (using an orthographic projection). I still want to use P2D as my renderer, I just need to do some 3D calculations.

PVectors seemed like the obvious way to go, but I couldn't find a way to rotate them about an arbitrary axes. screenX and the like seemed helpful, but again require P3D as renderer. I guess I could create a seperate PGraphics instance using P3D to get the points, but this seems like a hack. I could also write my own class to do this, but this must be built in to the language somehow...
Re: 3D Calculations without the 3D Renderer
Reply #1 - Mar 26th, 2010, 2:58pm
 
For purposes here, vectors don't "perform transforms", they just "get transformed".  So you need a matrix to define and perform the transform (and yes, there's an arbitrary axis rotate) f.e.:
PMatrix3D m = new PMatrix3D();
m.rotate(angle,x,y,z);
m.mult(yourSourceVector, yourTargetVector);
Page Index Toggle Pages: 1