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.
Page Index Toggle Pages: 1
3-axis "rotate" function (Read 967 times)
3-axis "rotate" function
Oct 9th, 2005, 6:21pm
 
I'm writing an app that'll need to do a large number of 3d rotations per frame, and as such am seeking a single function to rotate the coordinate space in all 3 dimensions simultaneously. I know I could rotateX(), rotateY(), rotateZ(), but that's a threefold increase in the number of matrix ops the software has to do, per object.  

Are there plans to implement a rotate(x,y,z) function that performs one matrix op in the near future?

If not, I'm going to try to put one together myself. I can't guarantee how efficient it'll be, but I'll be glad to submit it for inclusion in a future version once I get it working..

Ryan
Re: 3-axis "rotate" function
Reply #1 - Oct 9th, 2005, 6:59pm
 
rotate(angle,x,y,z);
God (that would be Casey or Ben) knows how it works:
Code:

void setup(){
size(400,400,P3D);
}
void draw(){
rotate(0.5,0.5,0.5,0.6);
rect(100,100,100,100);
}

You might want a look at Ariel's arcball. It was completely portable for a GUI I was working on. And it uses the four parameter rotation. v3ga uses that kind of hocus too.

I'd recommend rotate(angle,x,y,z) being added to the documentation though. Perhaps not on the same page as rotate(angle), it's a bit more upmarket.
Re: 3-axis "rotate" function
Reply #2 - Oct 10th, 2005, 4:56pm
 
rotate(angle, x, y, z) rotates by the specified amount around a vector... it's from the opengl syntax:
http://developer.3dlabs.com/documents/GLmanpages/glrotate.htm
though not being god myself, i often prefer just using rotateX etc al, or a nice arcball implementation.
Page Index Toggle Pages: 1