public static void Multiply(ref RigidTransform3 rigidTransform, ref AffineTransform3 affineTransform, out AffineTransform3 result) { Matrix3.FromQuaternion(ref rigidTransform.Orientation, out result.Transform); Matrix3.Multiply(ref result.Transform, ref affineTransform.Transform, out result.Transform); Vector3.Transform(ref rigidTransform.Position, ref affineTransform.Transform, out result.Translation); result.Translation += affineTransform.Translation; }
public AffineTransform3 Multiply(ref RigidTransform3 transform) { AffineTransform3 result; Matrix3.FromQuaternion(ref transform.Orientation, out result.Transform); Matrix3.Multiply(ref result.Transform, ref Transform, out result.Transform); Vector3.Transform(ref transform.Position, ref Transform, out result.Translation); result.Translation += Translation; return(result); }
public static void RotateAround(ref Matrix3 matrix, ref Vector3 axis, float angle, out Matrix3 result) { // rotate into world space var quaternion = Reign.Core.Quaternion.FromRotationAxis(axis, 0); Reign.Core.Quaternion.Conjugate(ref quaternion, out quaternion); Matrix3.FromQuaternion(ref quaternion, out result); Matrix3.Multiply(ref matrix, ref result, out result); // rotate back to matrix space Reign.Core.Quaternion.FromRotationAxis(ref axis, angle, out quaternion); var qMat = Matrix3.FromQuaternion(quaternion); Matrix3.Multiply(ref result, ref qMat, out result); }
public Matrix3 RotateAround(ref Vector3 axis, float angle) { // rotate into world space var quaternion = Reign.Core.Quaternion.FromRotationAxis(axis, 0); Reign.Core.Quaternion.Conjugate(ref quaternion, out quaternion); var worldSpaceMatrix = Matrix3.FromQuaternion(quaternion); Matrix3.Multiply(ref this, ref worldSpaceMatrix, out worldSpaceMatrix); // rotate back to matrix space Reign.Core.Quaternion.FromRotationAxis(ref axis, angle, out quaternion); var qMat = Matrix3.FromQuaternion(quaternion); Matrix3.Multiply(ref worldSpaceMatrix, ref qMat, out worldSpaceMatrix); return(worldSpaceMatrix); }