示例#1
0
        static public void Test()
        {
            UQuaternion q1 = new UQuaternion(.1f, .2f, .3f, -4);
            UQuaternion q2 = new UQuaternion(10, 9, -8, 7);

            Debug.Assert(q1.Equals(ToUnity(FromUnity(q1))));
            Debug.Assert(q2.Equals(ToUnity(FromUnity(q2))));

            Debug.Assert(q1.normalized.EqTest(ToUnity(FromUnity(q1).normalized)));
            Debug.Assert(q2.normalized.EqTest(ToUnity(FromUnity(q2).normalized)));

            q1.Normalize();                     // Unity's inverse method only works for normalized
            q2.Normalize();                     // Quaternions.

            Debug.Assert(UQuaternion.Inverse(q1).Equals(ToUnity(Inverse(FromUnity(q1)))));
            Debug.Assert(UQuaternion.Inverse(q2).EqTest(ToUnity(Inverse(FromUnity(q2)))));


            Debug.Assert((q1 * q2).Equals(ToUnity(FromUnity(q1 * q2))));
            Debug.Assert((q2 * q1).Equals(ToUnity(FromUnity(q2 * q1))));

            Vector3  axis;
            DVector3 daxis;
            float    angle;

            axis  = new Vector3(1, 2, 3);
            daxis = DVector3.FromUnity(axis);
            angle = 27;

            Debug.Assert(UQuaternion.AngleAxis(angle, axis).EqTest(ToUnity(DQuaternion.AngleAxis(angle, daxis))));

            axis  = new Vector3(-1, 2, -.1f);
            daxis = DVector3.FromUnity(axis);
            angle = -500;
            Debug.Assert(UQuaternion.AngleAxis(angle, axis).EqTest(ToUnity(DQuaternion.AngleAxis(angle, daxis))));
        }
 public bool Equals(PlacedObject other)
 {
     return(PrefabIndex == other.PrefabIndex && Scale.Equals(other.Scale) && Position.Equals(other.Position) && BoundingBox.Equals(other.BoundingBox) && Rotation.Equals(other.Rotation) && ProjectedArea.Equals(other.ProjectedArea));
 }
// methods

    static bool Quaternion_Equals__Object(JSVCall vc, int argc)
    {
        int len = argc;

        if (len == 1)
        {
            System.Object          arg0    = (System.Object)JSMgr.datax.getWhatever((int)JSApi.GetType.Arg);
            UnityEngine.Quaternion argThis = (UnityEngine.Quaternion)vc.csObj;                JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(argThis.Equals(arg0)));
            JSMgr.changeJSObj(vc.jsObjID, argThis);
        }

        return(true);
    }
示例#4
0
 public bool Equals(Quaternion q)
 {
     return q.Equals(ToQuaternion());
 }