コード例 #1
0
        public void ShouldHandleInvalidAxisAngleOnConversionToQuaternionCorrectly()
        {
            AxisAngle aa = new AxisAngle { Axis = new Vector { x = 0, y = 0, z = 0 }, Angle = 1 };
            Quat q = aa.ToQuaternion();

            Assert.That(q.x, Is.EqualTo(0).Within(EPS));
            Assert.That(q.y, Is.EqualTo(0).Within(EPS));
            Assert.That(q.z, Is.EqualTo(0).Within(EPS));
            Assert.That(q.w, Is.EqualTo(1).Within(EPS));
        }
コード例 #2
0
        public void ShouldConvertToQuaternionCorrectly()
        {
            AxisAngle aa = new AxisAngle { Axis = new Vector { x = 1, y = 2, z = 3 }, Angle = 4 };
            Quat q = aa.ToQuaternion();

            Assert.That(q.x, Is.EqualTo(0.2430199533700943).Within(EPS));
            Assert.That(q.y, Is.EqualTo(0.4860399067401886).Within(EPS));
            Assert.That(q.z, Is.EqualTo(0.7290598750114441).Within(EPS));
            Assert.That(q.w, Is.EqualTo(-0.416146844625473).Within(EPS));
        }
コード例 #3
0
        public void ShouldHandleInvalidAxisAngleOnConversionToQuaternionCorrectly()
        {
            AxisAngle aa = new AxisAngle {
                Axis = new Vector {
                    x = 0, y = 0, z = 0
                }, Angle = 1
            };
            Quat q = aa.ToQuaternion();

            Assert.That(q.x, Is.EqualTo(0).Within(EPS));
            Assert.That(q.y, Is.EqualTo(0).Within(EPS));
            Assert.That(q.z, Is.EqualTo(0).Within(EPS));
            Assert.That(q.w, Is.EqualTo(1).Within(EPS));
        }
コード例 #4
0
        public void ShouldConvertToQuaternionCorrectly()
        {
            AxisAngle aa = new AxisAngle {
                Axis = new Vector {
                    x = 1, y = 2, z = 3
                }, Angle = 4
            };
            Quat q = aa.ToQuaternion();

            Assert.That(q.x, Is.EqualTo(0.2430199533700943).Within(EPS));
            Assert.That(q.y, Is.EqualTo(0.4860399067401886).Within(EPS));
            Assert.That(q.z, Is.EqualTo(0.7290598750114441).Within(EPS));
            Assert.That(q.w, Is.EqualTo(-0.416146844625473).Within(EPS));
        }
コード例 #5
0
ファイル: ClientDriver.cs プロジェクト: tospie/FiVES
        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);
        }
コード例 #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);
        }