quat(0, 0, 0, 1) 時の AxisAngle

This commit is contained in:
ousttrue
2021-10-15 14:10:52 +09:00
parent 255ad03cd2
commit cee27ed12b

View File

@@ -49,6 +49,10 @@ namespace UniGLTF
public static (Vector3, float) GetAxisAngle(this Quaternion q)
{
var qw = q.W;
if (qw == 1)
{
return (Vector3.UnitX, 0);
}
var angle = 2 * Math.Acos(qw);
var x = q.X / Math.Sqrt(1 - qw * qw);
var y = q.Y / Math.Sqrt(1 - qw * qw);