Author Topic: translation  (Read 4691 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: translation
« Reply #15 on: January 04, 2010, 10:00:28 pm »
I forgot about that get-thingy...i've updated the beta-jar with it. In addition, i've added a transpose-method to Matrix.

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: translation
« Reply #16 on: January 23, 2010, 11:47:43 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 ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: translation
« Reply #17 on: January 24, 2010, 01:55:35 pm »
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...

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: translation
« Reply #18 on: January 24, 2010, 06:47:47 pm »
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 ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: translation
« Reply #19 on: January 24, 2010, 08:20:36 pm »
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?

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: translation
« Reply #20 on: January 24, 2010, 08:53:39 pm »
i see. i'm not sure i depend on it, but i guess not

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: translation
« Reply #21 on: January 24, 2010, 08:56:38 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...

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: translation
« Reply #22 on: January 24, 2010, 09:07:04 pm »
sure

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: translation
« Reply #23 on: January 26, 2010, 04:34:33 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 ;)