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()); }
void Update() { var forward = new Vec3(Mathf.Cos(rot), Mathf.Sin(rot), 1).Normalize(); var up = new Vec3(Mathf.Sin(rot), 1, 0).Normalize(); var mat = Mat3.LookAt(forward, up); Debug.DrawRay(Vector3.zero, mat.x.ToVector3(), Color.red); Debug.DrawRay(Vector3.zero, mat.y.ToVector3(), Color.green); Debug.DrawRay(Vector3.zero, mat.z.ToVector3(), Color.blue); rot += Time.deltaTime; }