Esempio n. 1
0
 public MovableQuat(Matrix transform)
 {
     Matrix3 rotation = new Matrix3 (transform);
     m_rotation = rotation.getQuaternion ();
     m_position = transform.Translation;
     m_scale = new Vector3 (1.0f);
 }
Esempio n. 2
0
 public MovableQuat(Vector3 forward, Vector3 up, Vector3 position)
 {
     Matrix3 rotation = new Matrix3 (forward, up, true);
     m_rotation = rotation.getQuaternion ();
     m_position = position;
     m_scale = new Vector3 (1.0f);
 }
Esempio n. 3
0
 public EulerAngles(Matrix3 rotation)
 {
     float sineOfPitch = -rotation.Forward.Y;
     if (MuxMath.equals (Math.Abs (sineOfPitch), 1.0f))
     {
         // pitched 90 or -90
         m_pitch = MathHelper.PiOver2 * sineOfPitch;
         m_yaw = (float)Math.Atan2 (-rotation.Right.Z, rotation.Right.X);
         m_roll = 0.0f;
     }
     else
     {
         m_pitch = (float)Math.Asin (sineOfPitch);
         m_yaw = (float)Math.Atan2 (rotation.Forward.X, rotation.Forward.Z);
         m_roll = (float)Math.Atan2 (-rotation.Right.Y, rotation.Up.Y);
     }
 }
Esempio n. 4
0
 public Matrix4(Vector3 forward, Vector3 up, Vector3 translation, bool ensureOrthonormal)
 {
     M = new Matrix3 (forward, up, true);
     this.t = translation;
 }
Esempio n. 5
0
 public void transform(Quaternion q)
 {
     Matrix3 m = new Matrix3 (q);
     transform (m);
 }
Esempio n. 6
0
 internal static Matrix3 createYawPitchRollRad(float yaw, float pitch, float roll)
 {
     Matrix3 rotate = new Matrix3 ();
     rotate.setYawPitchRollRad (yaw, pitch, roll);
     return (rotate);
 }
Esempio n. 7
0
 // this = this * "m"
 public void postMultiply(Matrix3 m)
 {
     this *= m;
 }
Esempio n. 8
0
 public static void invert(ref Matrix3 m, out Matrix3 inverse)
 {
     Matrix3 copy = m;
     copy.invert ();
     inverse = copy;
 }
Esempio n. 9
0
 /************************************************************/
 static Matrix3()
 {
     ms_identity = new Matrix3 (true);
 }
Esempio n. 10
0
 public Movable(Matrix3 rotation)
 {
     m_rotation = rotation;
     m_position = Vector3.Zero;
     m_scale = new Vector3 (1,1,1);
 }
Esempio n. 11
0
 public void billboard(Camera camera)
 {
     Vector3 forward = camera.Position - m_position;
     forward.Normalize ();
     Matrix3 billboard = new Matrix3 (forward, camera.Up);
     m_rotation = billboard.getQuaternion ();
 }
Esempio n. 12
0
 public Matrix4(Matrix3 m, Vector3 scale, Vector3 translation)
 {
     M = m;
     M.Right *= scale.X;
     M.Up *= scale.Y;
     M.Forward *= scale.Z;
     this.t = translation;
 }
Esempio n. 13
0
 public Matrix4(Matrix3 m, Vector3 translation, bool ensureOrthonormal)
 {
     M = m;
     m.makeOrthonormalCross ();
     this.t = translation;
 }
Esempio n. 14
0
 public Matrix4(Matrix3 m, Vector3 translation)
 {
     M = m;
     this.t = translation;
 }
Esempio n. 15
0
 public Matrix4(Quaternion q)
 {
     M = new Matrix3 (q);
     t = Vector3.Zero;
 }
Esempio n. 16
0
 /// Rotate about the local up axis
 public void yaw(float angleDeg)
 {
     Matrix3 rotate = new Matrix3 ();
     rotate.setRotateAxis (this.Up, angleDeg);
     m_rotation.Right *= rotate;
     m_rotation.Forward *= rotate;
 }
Esempio n. 17
0
 public Movable(Vector3 forward, Vector3 up, Vector3 position)
 {
     m_rotation = new Matrix3 (forward, up, true);
     m_position = position;
     m_scale = new Vector3 (1,1,1);
 }
Esempio n. 18
0
 public MovableQuat(Matrix3 rotation)
 {
     m_rotation = rotation.getQuaternion ();
     m_position = Vector3.Zero;
     m_scale = new Vector3 (1.0f);
 }
Esempio n. 19
0
 public Movable(MuxEngine.LinearAlgebra.Matrix4 xform)
 {
     m_rotation = xform.Rotation;
     m_position = xform.Translation;
     m_scale = new Vector3 (1,1,1);
 }
Esempio n. 20
0
 /// Rotate about the local right axis
 public void pitch(float angleDeg)
 {
     Matrix3 rotate = new Matrix3 ();
     rotate.setRotateAxis (this.Right, angleDeg);
     m_rotation.Up *= rotate;
     m_rotation.Forward *= rotate;
 }
Esempio n. 21
0
 public static Matrix3 createYawPitchRoll(float yawDeg, float pitchDeg, float rollDeg)
 {
     Matrix3 rotate = new Matrix3 ();
     rotate.setYawPitchRoll (yawDeg, pitchDeg, rollDeg);
     return (rotate);
 }
Esempio n. 22
0
 /// Rotate about "axis" through "p"
 public void rotateAboutPoint(Vector3 p, Vector3 axis, float angleDeg)
 {
     Matrix3 rotate = new Matrix3 ();
     rotate.setRotateAxis (axis, angleDeg);
     m_rotation *= rotate;
     m_position *= rotate;
     m_position += -p * rotate + p;
 }
Esempio n. 23
0
 public void decompose(out Vector3 scale, out Quaternion rotation)
 {
     EVector3 right = new EVector3 (this.Right);
     scale.X = right.normalize ();
     EVector3 up = new EVector3 (this.Up);
     scale.Y = up.normalize ();
     EVector3 forward = new EVector3 (this.Forward);
     scale.Z = forward.normalize ();
     Matrix3 m = new Matrix3 (right, up, forward);
     rotation = m.getQuaternion ();
 }
Esempio n. 24
0
 // Rotate about "axis" through origin
 public void rotateWorld(Vector3 axis, float angleDeg)
 {
     Matrix3 rotate = new Matrix3 ();
     rotate.setRotateAxis (axis, angleDeg);
     m_rotation *= rotate;
     m_position *= rotate;
 }
Esempio n. 25
0
 // this = "m" * this
 public void preMultiply(Matrix3 m)
 {
     this = m * this;
 }
Esempio n. 26
0
 /************************************************************/
 public Movable()
 {
     m_rotation = Matrix3.Identity;
     m_position = Vector3.Zero;
     m_scale = new Vector3 (1,1,1);
 }
Esempio n. 27
0
 // this' = this * M; right-multiply matrix semantics
 public void transform(Matrix3 m)
 {
     float tx = X * m.Right.X + Y * m.Up.X + Z * m.Backward.X;
     float ty = X * m.Right.Y + Y * m.Up.Y + Z * m.Backward.Y;
     float tz = X * m.Right.Z + Y * m.Up.Z + Z * m.Backward.Z;
     X = tx;
     Y = ty;
     Z = tz;
 }
Esempio n. 28
0
 /// Rotate about world Y axis, preserving position
 public void rotateWorldY(float angleDeg)
 {
     Matrix3 rotate = new Matrix3 ();
     rotate.setRotateY (angleDeg);
     m_rotation *= rotate;
 }
Esempio n. 29
0
 // this' = this * M^(-1); right-multiply matrix semantics
 public void transformByInverse(Matrix3 m)
 {
     m.invert ();
     transform (m);
 }
Esempio n. 30
0
 public Matrix4(Vector3 forward, Vector3 up, Vector3 translation)
 {
     M = new Matrix3 (forward, up);
     this.t = translation;
 }