Vectors

Started by
10 comments, last by apatriarca 12 years, 9 months ago

I don't know if your familiar with vb.net but here is the code.



Dim v as new vector3(1,2,3)
Dim radian as single = 0.0174532925
Dim qx as Quaternion = Quaternion.RotationAxis(new Vector3(1,0,0), 45 * radian)
Dim qy as Quaternion = Quaternion.RotationAxis(new Vector3(0,1,0), 0 * radian)
Dim qz as Quaternion = Quaternion.RotationAxis(new Vector3(0,0,-1), -90 * radian)
Dim zz as matrix = Matrix.RotationQuaternion(qz * qx * qy)
Dim rb as vector3 = vector3.TransformCoordinate(v, zz)




if i change qx to 0 degree and qz to 90 i get acceptable results i think

same with qx to 0 and qz to -90

and if i leave the code with 45,0,-90 it seems okay i think

Gary


Nope, thats not right
Advertisement
A rotated box is, in general, no longer axis-aligned and it doesn't make sense to speak about "dimensions" in that way. A rotated box isn't a scaled cube! If you want to represent a scaled and rotated cube in space you have to use a different representation for your transformations (a matrix or a vector for the scale factors - what you call "dimensions" - and a quaternion or euler angles for the rotation). I do not understand what your image represents. :huh:

This topic is closed to new replies.

Advertisement