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)); }
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)); }
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); }
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); }