public void ShouldHandleInvalidQuaternionCorrectly()
        {
            Quat q = new Quat { x = 0, y = 0, z = 0, w = 10 };
            AxisAngle aa = new AxisAngle();
            aa.FromQuaternion(q);

            Assert.That(aa.Axis.x, Is.EqualTo(0).Within(EPS));
            Assert.That(aa.Axis.y, Is.EqualTo(0).Within(EPS));
            Assert.That(aa.Axis.z, Is.EqualTo(1).Within(EPS));
            Assert.That(aa.Angle, Is.EqualTo(0).Within(EPS));
        }
        public void ShouldConvertFromQuaternionCorrectly()
        {
            Quat q = new Quat { x = 0.2430199533700943, y = 0.4860399067401886, z = 0.7290598750114441,
                                w = -0.416146844625473 };
            AxisAngle aa = new AxisAngle();
            aa.FromQuaternion(q);

            Assert.That(aa.Axis.x, Is.EqualTo(0.26726123690605164).Within(EPS));
            Assert.That(aa.Axis.y, Is.EqualTo(0.5345224738121033).Within(EPS));
            Assert.That(aa.Axis.z, Is.EqualTo(0.8017837405204773).Within(EPS));
            Assert.That(aa.Angle, Is.EqualTo(4.000000017768291).Within(EPS));
        }
Ejemplo n.º 3
0
        public void ShouldHandleInvalidQuaternionCorrectly()
        {
            Quat q = new Quat {
                x = 0, y = 0, z = 0, w = 10
            };
            AxisAngle aa = new AxisAngle();

            aa.FromQuaternion(q);

            Assert.That(aa.Axis.x, Is.EqualTo(0).Within(EPS));
            Assert.That(aa.Axis.y, Is.EqualTo(0).Within(EPS));
            Assert.That(aa.Axis.z, Is.EqualTo(1).Within(EPS));
            Assert.That(aa.Angle, Is.EqualTo(0).Within(EPS));
        }
Ejemplo n.º 4
0
        public void ShouldConvertFromQuaternionCorrectly()
        {
            Quat q = new Quat {
                x = 0.2430199533700943, y = 0.4860399067401886, z = 0.7290598750114441,
                w = -0.416146844625473
            };
            AxisAngle aa = new AxisAngle();

            aa.FromQuaternion(q);

            Assert.That(aa.Axis.x, Is.EqualTo(0.26726123690605164).Within(EPS));
            Assert.That(aa.Axis.y, Is.EqualTo(0.5345224738121033).Within(EPS));
            Assert.That(aa.Axis.z, Is.EqualTo(0.8017837405204773).Within(EPS));
            Assert.That(aa.Angle, Is.EqualTo(4.000000017768291).Within(EPS));
        }
Ejemplo n.º 5
0
        void RotateEntity(EntityInfo info)
        {
            AxisAngle aa = new AxisAngle();

            aa.FromQuaternion(info.Orientation);
            aa.Angle += 0.1;

            if (aa.Angle > 2 * Math.PI)
            {
                aa.Angle = 0;
            }

            info.Orientation = aa.ToQuaternion();

            communicator.Call("location.updateOrientation", info.Guid, info.Orientation, Timestamps.UnixTimestamp);
        }
Ejemplo n.º 6
0
        void RotateEntity(EntityInfo info)
        {
            AxisAngle aa = new AxisAngle();
            aa.FromQuaternion(info.Orientation);
            aa.Angle += 0.1;

            if (aa.Angle > 2 * Math.PI)
                aa.Angle = 0;

            info.Orientation = aa.ToQuaternion();

            communicator.Call("location.updateOrientation", info.Guid, info.Orientation, Timestamps.UnixTimestamp);
        }