/// <summary> /// Initialize using a position vector and a rotation matrix. /// </summary> /// <param name="position"></param> /// <param name="R"></param> public Transform(Vector2 position, Quaternion rotation) { this.position = position; this.rotation = rotation; }
/// <summary> /// Multiply a matrix transpose times a vector. If a rotation matrix is provided, /// then this Transforms the vector from one frame to another (inverse Transform). /// </summary> public static Vector2 MulT(Mat22 A, Vector2 v) { return(new Vector2(Vector2.Dot(v, A.Col1), Vector2.Dot(v, A.Col2))); }
/// <summary> /// Initialize using a position vector and a rotation matrix. /// </summary> /// <param name="position"></param> /// <param name="R"></param> public Transform(Vector2 position, Mat22 rotation) { this.position = position; this.rotation = rotation; }
/// <summary> /// Multiply a matrix times a vector. If a rotation matrix is provided, /// then this Transforms the vector from one frame to another. /// </summary> public static Vector2 Mul(Mat22 A, Vector2 v) { return(new Vector2(A.Col1.X * v.X + A.Col2.X * v.Y, A.Col1.Y * v.X + A.Col2.Y * v.Y)); }
/// <summary> /// Initialize using a position vector and a rotation matrix. /// </summary> /// <param name="position"></param> /// <param name="R"></param> public XForm(Vec2 position, Mat22 rotation) { Position = position; R = rotation; }
/// Set this based on the position and angle. public void Set(Vector2 p, float angle) { position = p; R = new Mat22(angle); }
/// <summary> /// Set this to the identity transform. /// </summary> public void SetIdentity() { position = Vector2.Zero; R = Mat22.Identity; }
/// <summary> /// Initialize using a position vector and a rotation matrix. /// </summary> /// <param name="position"></param> /// <param name="R"></param> public XForm(Vector2 p, Mat22 rotation) { position = p; R = rotation; }