rotation by matrix

Started by raft, March 12, 2010, 08:03:57 AM

Previous topic - Next topic

raft

i have a rotation matrix multiplied by a uniform scale matrix.

* SimpleVector.rotate(matrix) also applies scaling to vector, is this intentional ?
* how can i check rotation part (upper 3x3) of matrix has no scale information ?
* how can i clear scaling from matrix ? assuming i dont know scaling value

thanks

EgonOlsen

Yes, that is intentional... ;D


Maybe this works (as long as the scaling is uniform):


  • create a SimpleVector of length 1 (for example 1,0,0)
  • multiply it with the matrix
  • calculate it's length
  • if it's not 1, do a scalarMul on the matrix with 1/length

Should work, but might not be the best or fastest way to do it...only a pragmatic way.

raft

yes it works, thanks :)

so, assuming there is no translation in matrix, multiplying it with scalar is practically the same as multiplying with a uniform scale matrix. and of course less expensive. i didnt know this

EgonOlsen

Just do it once on paper and you'll see... ;)