예제 #1
0
 public static void Validate(this AffineTransform a)
 {
     a.LinearTransform.Validate();
     a.Translation.Validate();
 }
예제 #2
0
 ///<summary>
 /// Inverts an affine transform.
 ///</summary>
 ///<param name="transform">Transform to invert.</param>
 /// <param name="inverse">Inverse of the transform.</param>
 public static void Invert(ref AffineTransform transform, out AffineTransform inverse)
 {
     Matrix3x3.Invert(ref transform.LinearTransform, out inverse.LinearTransform);
     Matrix3x3.Transform(ref transform.Translation, ref inverse.LinearTransform, out inverse.Translation);
     Vector3.Negate(ref inverse.Translation, out inverse.Translation);
 }
예제 #3
0
 /// <summary>
 /// Creates an affine transform from a rigid transform.
 /// </summary>
 /// <param name="rigid">Rigid transform to base the affine transform on.</param>
 /// <param name="affine">Affine transform created from the rigid transform.</param>
 public static void CreateFromRigidTransform(ref RigidTransform rigid, out AffineTransform affine)
 {
     affine.Translation = rigid.Position;
     Matrix3x3.CreateFromQuaternion(ref rigid.Orientation, out affine.LinearTransform);
 }
예제 #4
0
 ///<summary>
 /// Transforms a vector by an affine transform.
 ///</summary>
 ///<param name="position">Position to transform.</param>
 ///<param name="transform">Transform to apply.</param>
 ///<param name="transformed">Transformed position.</param>
 public static void Transform(ref Vector3 position, ref AffineTransform transform, out Vector3 transformed)
 {
     Matrix3x3.Transform(ref position, ref transform.LinearTransform, out transformed);
     Vector3.Add(ref transformed, ref transform.Translation, out transformed);
 }