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
3d point rotation (Read 1338 times)
3d point rotation
Sep 3rd, 2005, 12:37am
 
Hi again!

I was plotting some objects with vertex() after writing a cinema 4d file importer. When i tried rotating the object using rotateZ() it did not work.
Someone succeed?
I guess i'll have to try matrix multiplication, sure it'll work but will decrease the computer speed.

Matrix multiplication or did someone succeed using rotateX() with vertex()?

Thanx all Smiley G'nite.
Re: 3d point rotation
Reply #1 - Sep 3rd, 2005, 12:54pm
 
unfortunately you can't mix vertex() (or anything inside beginShape/endShape) with calls to rotate() and friends:
http://processing.org/reference/beginShape_.html

if you need to rotate you can use sin() and cos() to get rotated points.. for instance this will give you rotateZ():

float xx = (x - centerX) * cos(angle);
float yy = (y - centerY) * sin(angle);

or something like that (yy may need to be set negative or something.. i haven't tested this). centerX and centerY are the center point used for the rotation.
Re: 3d point rotation
Reply #2 - Sep 3rd, 2005, 11:10pm
 
I haven't tested that, but it worked fine with matrix multiplication.

Thanx fry
Page Index Toggle Pages: 1