public void QuaternionToEuler_MainRotations(float3 expected, Quaternion quat) { var actual = Quaternion.QuaternionToEuler(quat, true); Assert.Equal(expected.x, actual.x, 4); Assert.Equal(expected.y, actual.y, 4); Assert.Equal(expected.z, actual.z, 4); }
// TODO: Check if transform is right, or lefthanded and transform it accordingly, to match imported scene and scene display in FUSEE private static TransformComponent GetXForm(Matrix4x4 transform) { Vector3D scaling, translation; AsQuaternion rotation; transform.Decompose(out scaling, out rotation, out translation); FuQuaternion fuRot = new FuQuaternion(rotation.X, rotation.Y, rotation.Z, rotation.W); float3 ypr = FuQuaternion.QuaternionToEuler(fuRot); return(new TransformComponent { Translation = new float3(translation.X, translation.Y, translation.Z), Rotation = ypr, Scale = new float3(scaling.X, scaling.Y, scaling.Z) }); }