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 & HelpPrograms › [SOLVED]Is applyMatrix() correct
Page Index Toggle Pages: 1
[SOLVED]Is applyMatrix() correct? (Read 433 times)
[SOLVED]Is applyMatrix() correct?
Mar 12th, 2008, 7:34am
 
Hello.
I want to controll transformation 3D objects by not to use processing methods "rotateX,Y,Z()", but to use an original matrix class.

At first, I prepared a vector(x, y, z) transformed by an original matrix class object.And called "line(0,0,0,x,y,z);".
It was drawn correctly so I can tell this transformation matrix is corret.
Next, I called "applyMatrix()" parameter is a same matrix object as last time. And called "box(50)".

In the course of nature, the box should have completely same rotation as a line(0,0,0,x,y,z). but the box rotates different angle as I expected.
Does applyMatrix() method has a bug?
Please tell me some good idea of in useing original matrix calculation and apply it to processing matrix.
if you need source codes, I post them.
Re: Is applyMatrix() correct?
Reply #1 - Mar 13th, 2008, 8:44am
 
hi,

Now I figure out why this problem happens.
but It is difficult for me to explain because Im not good English speaker.

the only a thing I can say is, the default coordinate system for proce55ing 3DObjects(.ex box(), sphere().. ) is not same as one for line().
so this problem can be solve by modifying the coordinate system by useing "normal()" method.

Re: [SOLVED]Is applyMatrix() correct?
Reply #2 - Mar 17th, 2008, 12:15pm
 
I thought that you should avoid applyMatrix() where possible as it is inefficient and slow?
Re: [SOLVED]Is applyMatrix() correct?
Reply #3 - Mar 17th, 2008, 1:22pm
 
hi,

thank you for replying.

yes, you are right indeed.
I decided not to use applyMatrix().
Now I've drawn 3DObjects by useing OBJLoader library.
To rotate a model, transform all of its vertexs by an original matrix class and methods.
And It works fine.
In this way, can rotate 3DObjects more freely for example rotation by Quaternion.
Page Index Toggle Pages: 1