Main Menu

translation

Started by raft, January 03, 2010, 03:00:59 PM

Previous topic - Next topic

EgonOlsen

I forgot about that get-thingy...i've updated the beta-jar with it. In addition, i've added a transpose-method to Matrix.

raft

Quote from: EgonOlsen on January 03, 2010, 08:25:49 PM
It's only a problem if you assign such a matrix to an Object3D as rotation matrix. If you never do this and use it in combination with Matrix and SimpleVector, it's all fine.

how should i apply a non-uniform scaling to a Matrix such that when it's multiplied with a SimpleVector it will scaled accordingly ? i mean to which elements of Matrix should i apply the scaling ?

EgonOlsen

Just apply a normal scaling matrix to the matrix in question. That's the easiest way IMHO.

BTW: Have you ever noticed that the rotate?-methods in Matrix only work on the upper 3x3 part of the matrix? That means that it's not possible to transform a translation matrix (or a combined one) into the OpenGL coordinate system by using them. Never had a problem with that? I'm just asking because this stupid thing took me 2 days to figure out. I'll correct this...

raft

i dont have a scaling matrix, just a vector. i guess i need to multiply some elements of matrix with this scaling values such that, when a vector is multiplied with this matrix, scaling is applied. but which elements should i multiply ?

for your question, isnt it supposed to work so ? when you multiply a vector with a matrix, it's first rotated around origin then translated to new position. if matrix.rotate? methods modify the translation part, translation data will be corrupted and that behaviour will be broken, right ?

EgonOlsen

What i meant was to create a scaling matrix like here: http://en.wikipedia.org/wiki/Scaling_%28geometry%29 and apply that to your actual matrix. That way, you don't have to care about which elements to modify, the matMul will do that for you.

No, i don't think it's should work this way. Actually, a rotated translation matrix has to result in a rotated translation. In jPCT, the rotateAxis() works this way, the matMul() with a rotation matrix works this way...just the rotate?-method didn't, which can be convenient sometimes, but is actually wrong and can cause major headache. Are you relying on the false implementation somewhere in your code?

raft

i see. i'm not sure i depend on it, but i guess not

EgonOlsen

Quote from: raft on January 24, 2010, 08:53:39 PM
i see. i'm not sure i depend on it, but i guess not
Please let me know if you find out that you do...

raft


raft

Quote from: EgonOlsen on January 24, 2010, 08:56:38 PM
Please let me know if you find out that you do...
even if i depend on it, i really dont care if my code breaks for the sake of correct behaviour ;)