public static AffineTransform3 FromRigidTransform(RigidTransform3 transform) { AffineTransform3 result; result.Translation = transform.position; result.Transform = Mat3.FromQuaternion(transform.rotation); return(result); }
public AffineTransform3 Multiply(RigidTransform3 transform) { AffineTransform3 result; result.Transform = Mat3.FromQuaternion(transform.rotation); result.Transform = result.Transform.Multiply(Transform); result.Translation = transform.position.Transform(Transform); result.Translation += Translation; return(result); }
public void Matrix3() { FMat3 fm = FMat3.FromQuaternion(FQuat.Euler(( Fix64 )30, ( Fix64 )(-20), ( Fix64 )49.342f)); Mat3 m = Mat3.FromQuaternion(Quat.Euler(30, -20, 49.342f)); FVec3 fv = new FVec3(12.5f, 9, 8); FVec3 fv2 = new FVec3(4, 6, 9); Vec3 v = new Vec3(12.5f, 9, 8); Vec3 v2 = new Vec3(4, 6, 9); fv = fm.TransformPoint(fv); fv2 = fm.TransformVector(fv2); v = m.TransformPoint(v); v2 = m.TransformVector(v2); this._output.WriteLine(fm.ToString()); this._output.WriteLine(m.ToString()); this._output.WriteLine(fv.ToString()); this._output.WriteLine(fv2.ToString()); this._output.WriteLine(v.ToString()); this._output.WriteLine(v2.ToString()); fm = FMat3.LookAt(fv, fv2); m = Mat3.LookAt(v, v2); this._output.WriteLine(fm.ToString()); this._output.WriteLine(m.ToString()); fv = fm.Euler(); v = m.Euler(); this._output.WriteLine(fv.ToString()); this._output.WriteLine(v.ToString()); fm = FMat3.FromEuler(fv); m = Mat3.FromEuler(v); this._output.WriteLine(fm.ToString()); this._output.WriteLine(m.ToString()); fm = FMat3.FromScale(fv); m = Mat3.FromScale(v); this._output.WriteLine(fm.ToString()); this._output.WriteLine(m.ToString()); fm = FMat3.FromCross(fv); m = Mat3.FromCross(v); this._output.WriteLine(fm.ToString()); this._output.WriteLine(m.ToString()); fm = FMat3.FromOuterProduct(fv, fv2); m = Mat3.FromOuterProduct(v, v2); this._output.WriteLine(fm.ToString()); this._output.WriteLine(m.ToString()); fm = FMat3.FromRotationAxis(( Fix64 )35, fv); m = Mat3.FromRotationAxis(35, v); this._output.WriteLine(fm.ToString()); this._output.WriteLine(m.ToString()); fm = FMat3.NonhomogeneousInverse(fm); m = Mat3.NonhomogeneousInvert(m); this._output.WriteLine(fm.ToString()); this._output.WriteLine(m.ToString()); }
public AffineTransform3(Quat orientation, Vec3 scale, Vec3 translation) { Transform = Mat3.FromQuaternion(orientation) * scale; Translation = translation; }