public void Matrix4() { FMat4 fm = FMat4.FromQuaternion(FQuat.Euler(( Fix64 )30, ( Fix64 )(-20), ( Fix64 )49.342f)); Mat4 m = Mat4.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 = FMat4.FromEuler(fv); m = Mat4.FromEuler(v); this._output.WriteLine(fm.ToString()); this._output.WriteLine(m.ToString()); fm = FMat4.FromScale(fv); m = Mat4.FromScale(v); this._output.WriteLine(fm.ToString()); this._output.WriteLine(m.ToString()); fm = FMat4.FromRotationAxis(( Fix64 )35, fv); m = Mat4.FromRotationAxis(35, v); this._output.WriteLine(fm.ToString()); this._output.WriteLine(m.ToString()); fm = FMat4.NonhomogeneousInverse(fm); m = Mat4.NonhomogeneousInvert(m); this._output.WriteLine(fm.ToString()); this._output.WriteLine(m.ToString()); fm = FMat4.FromTRS(new FVec3(4, 5, 6), FQuat.identity, FVec3.one); m = Mat4.FromTRS(new Vec3(4, 5, 6), Quat.identity, Vec3.one); this._output.WriteLine(fm.ToString()); this._output.WriteLine(m.ToString()); fm = FMat4.NonhomogeneousInverse(fm); m = Mat4.NonhomogeneousInvert(m); this._output.WriteLine(fm.ToString()); this._output.WriteLine(m.ToString()); fv = fm.TransformPoint(fv); v = m.TransformPoint(v); this._output.WriteLine(fv.ToString()); this._output.WriteLine(v.ToString()); }
public void MTest() { var m = Mat4.FromTRS(new Vec3(1, -2, 3), Quat.Euler(new Vec3(90, 0, 0)), new Vec3(2, 3, 4)); this.Log(m.ToString()); m.Invert(); this.Log(m); this.Log(m.TransformPoint(new Vec3(1, 0, -1))); var m2 = Mat4.FromRotationAxis(-43, Vec3.Normalize(new Vec3(3, 2, 4))); this.Log(m2); var m3 = m2 * m; this.Log(m3); //var m4 = Mat3.FromOuterProduct( new Vec3( 1, -2, 3 ), new Vec3( 93, 44, 32 ) ); //var m5 = Mat3.FromCross( new Vec3( 2.5f, 3, 4 ) ); //var m6 = m4 * m5; //m6 = m6.RotateAround( 33, new Vec3( 2, 3, 4 ) ); //this.Log( m6 ); }