예제 #1
0
 public static QuaternionD Euler(double x, double y, double z)
 {
     return(QuaternionD.Internal_FromEulerRad(new Vector3d(x, y, z) * (Math.PI / 180.0)));
 }
예제 #2
0
 private static extern QuaternionD INTERNAL_CALL_Inverse(ref QuaternionD rotation);
예제 #3
0
        /*
         * public override string ToString()
         * {
         *      string fmt = "({0:F1}, {1:F1}, {2:F1}, {3:F1})";
         *      object[] objArray = new object[4];
         *      int index1 = 0;
         *      // ISSUE: variable of a boxed type
         *      __Boxed<double> local1 = (ValueType) this.x;
         *      objArray[index1] = (object) local1;
         *      int index2 = 1;
         *      // ISSUE: variable of a boxed type
         *      __Boxed<double> local2 = (ValueType) this.y;
         *      objArray[index2] = (object) local2;
         *      int index3 = 2;
         *      // ISSUE: variable of a boxed type
         *      __Boxed<double> local3 = (ValueType) this.z;
         *      objArray[index3] = (object) local3;
         *      int index4 = 3;
         *      // ISSUE: variable of a boxed type
         *      __Boxed<double> local4 = (ValueType) this.w;
         *      objArray[index4] = (object) local4;
         *      return UnityString.Format(fmt, objArray);
         * }
         *
         * public string ToString(string format)
         * {
         *      string fmt = "({0}, {1}, {2}, {3})";
         *      object[] objArray = new object[4];
         *      int index1 = 0;
         *      string str1 = this.x.ToString(format);
         *      objArray[index1] = (object) str1;
         *      int index2 = 1;
         *      string str2 = this.y.ToString(format);
         *      objArray[index2] = (object) str2;
         *      int index3 = 2;
         *      string str3 = this.z.ToString(format);
         *      objArray[index3] = (object) str3;
         *      int index4 = 3;
         *      string str4 = this.w.ToString(format);
         *      objArray[index4] = (object) str4;
         *      return UnityString.Format(fmt, objArray);
         * }
         */

        public static double Angle(QuaternionD a, QuaternionD b)
        {
            return((double)Mathd.Acos(Mathd.Min(Mathd.Abs(QuaternionD.Dot(a, b)), 1.0)) * 2.0 * 57.2957801818848);
        }
예제 #4
0
 public static double Dot(QuaternionD a, QuaternionD b)
 {
     return((double)a.x * (double)b.x + (double)a.y * (double)b.y + (double)a.z * (double)b.z + (double)a.w * (double)b.w);
 }
예제 #5
0
 public static QuaternionD Inverse(QuaternionD rotation)
 {
     return(QuaternionD.INTERNAL_CALL_Inverse(ref rotation));
 }
예제 #6
0
 private static extern Vector3d INTERNAL_CALL_Internal_ToEulerRad(ref QuaternionD rotation);
예제 #7
0
 private static void Internal_ToAxisAngleRad(QuaternionD q, out Vector3d axis, out double angle)
 {
     QuaternionD.INTERNAL_CALL_Internal_ToAxisAngleRad(ref q, out axis, out angle);
 }
예제 #8
0
        public static QuaternionD LookRotation(Vector3d forward)
        {
            Vector3d up = Vector3d.up;

            return(QuaternionD.INTERNAL_CALL_LookRotation(ref forward, ref up));
        }
예제 #9
0
 public void SetLookRotation(Vector3d view, [DefaultValue("Vector3d.up")] Vector3d up)
 {
     this = QuaternionD.LookRotation(view, up);
 }
예제 #10
0
 public void SetFromToRotation(Vector3d fromDirection, Vector3d toDirection)
 {
     this = QuaternionD.FromToRotation(fromDirection, toDirection);
 }
예제 #11
0
 public static QuaternionD LookRotation(Vector3d forward, [DefaultValue("Vector3d.up")] Vector3d upwards)
 {
     return(QuaternionD.INTERNAL_CALL_LookRotation(ref forward, ref upwards));
 }
예제 #12
0
 public static QuaternionD FromToRotation(Vector3d fromDirection, Vector3d toDirection)
 {
     return(QuaternionD.INTERNAL_CALL_FromToRotation(ref fromDirection, ref toDirection));
 }
예제 #13
0
 public void ToAngleAxis(out double angle, out Vector3d axis)
 {
     QuaternionD.Internal_ToAxisAngleRad(this, out axis, out angle);
     angle = angle * 57.29578;
 }
예제 #14
0
 public static QuaternionD AngleAxis(double angle, Vector3d axis)
 {
     return(QuaternionD.INTERNAL_CALL_AngleAxis(angle, ref axis));
 }
예제 #15
0
 public static QuaternionD Euler(Vector3d euler)
 {
     return(QuaternionD.Internal_FromEulerRad(euler * (Math.PI / 180.0)));
 }
예제 #16
0
 public static QuaternionD Lerp(QuaternionD from, QuaternionD to, double t)
 {
     return(QuaternionD.INTERNAL_CALL_Lerp(ref from, ref to, t));
 }
예제 #17
0
 private static Vector3d Internal_ToEulerRad(QuaternionD rotation)
 {
     return(QuaternionD.INTERNAL_CALL_Internal_ToEulerRad(ref rotation));
 }
예제 #18
0
 private static QuaternionD UnclampedSlerp(QuaternionD from, QuaternionD to, double t)
 {
     return(QuaternionD.INTERNAL_CALL_UnclampedSlerp(ref from, ref to, t));
 }
예제 #19
0
 private static QuaternionD Internal_FromEulerRad(Vector3d euler)
 {
     return(QuaternionD.INTERNAL_CALL_Internal_FromEulerRad(ref euler));
 }
예제 #20
0
 private static extern QuaternionD INTERNAL_CALL_UnclampedSlerp(ref QuaternionD from, ref QuaternionD to, double t);
예제 #21
0
 private static extern void INTERNAL_CALL_Internal_ToAxisAngleRad(ref QuaternionD q, out Vector3d axis, out double angle);
예제 #22
0
 public static bool operator !=(QuaternionD lhs, QuaternionD rhs)
 {
     return((double)QuaternionD.Dot(lhs, rhs) <= 0.999998986721039);
 }