### Author Topic: rotation by matrix  (Read 1362 times)

#### raft

• Posts: 1984
##### rotation by matrix
« on: March 12, 2010, 08:03:57 am »
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

• Posts: 11899
##### Re: rotation by matrix
« Reply #1 on: March 12, 2010, 08:28:33 am »
Yes, that is intentional...

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

• Posts: 1984
##### Re: rotation by matrix
« Reply #2 on: March 12, 2010, 08:44:05 am »
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