|
@@ -96,27 +96,6 @@ namespace Godot
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
|
- /// Returns the length (magnitude) of the quaternion.
|
|
|
|
- /// </summary>
|
|
|
|
- /// <seealso cref="LengthSquared"/>
|
|
|
|
- /// <value>Equivalent to <c>Mathf.Sqrt(LengthSquared)</c>.</value>
|
|
|
|
- public readonly real_t Length
|
|
|
|
- {
|
|
|
|
- get { return Mathf.Sqrt(LengthSquared); }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /// <summary>
|
|
|
|
- /// Returns the squared length (squared magnitude) of the quaternion.
|
|
|
|
- /// This method runs faster than <see cref="Length"/>, so prefer it if
|
|
|
|
- /// you need to compare quaternions or need the squared length for some formula.
|
|
|
|
- /// </summary>
|
|
|
|
- /// <value>Equivalent to <c>Dot(this)</c>.</value>
|
|
|
|
- public readonly real_t LengthSquared
|
|
|
|
- {
|
|
|
|
- get { return Dot(this); }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Returns the angle between this quaternion and <paramref name="to"/>.
|
|
/// Returns the angle between this quaternion and <paramref name="to"/>.
|
|
/// This is the magnitude of the angle you would need to rotate
|
|
/// This is the magnitude of the angle you would need to rotate
|
|
@@ -355,7 +334,7 @@ namespace Godot
|
|
/// <returns>A <see langword="bool"/> for whether the quaternion is normalized or not.</returns>
|
|
/// <returns>A <see langword="bool"/> for whether the quaternion is normalized or not.</returns>
|
|
public readonly bool IsNormalized()
|
|
public readonly bool IsNormalized()
|
|
{
|
|
{
|
|
- return Mathf.Abs(LengthSquared - 1) <= Mathf.Epsilon;
|
|
|
|
|
|
+ return Mathf.Abs(LengthSquared() - 1) <= Mathf.Epsilon;
|
|
}
|
|
}
|
|
|
|
|
|
public readonly Quaternion Log()
|
|
public readonly Quaternion Log()
|
|
@@ -364,13 +343,34 @@ namespace Godot
|
|
return new Quaternion(v.x, v.y, v.z, 0);
|
|
return new Quaternion(v.x, v.y, v.z, 0);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Returns the length (magnitude) of the quaternion.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <seealso cref="LengthSquared"/>
|
|
|
|
+ /// <value>Equivalent to <c>Mathf.Sqrt(LengthSquared)</c>.</value>
|
|
|
|
+ public readonly real_t Length()
|
|
|
|
+ {
|
|
|
|
+ return Mathf.Sqrt(LengthSquared());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Returns the squared length (squared magnitude) of the quaternion.
|
|
|
|
+ /// This method runs faster than <see cref="Length"/>, so prefer it if
|
|
|
|
+ /// you need to compare quaternions or need the squared length for some formula.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <value>Equivalent to <c>Dot(this)</c>.</value>
|
|
|
|
+ public readonly real_t LengthSquared()
|
|
|
|
+ {
|
|
|
|
+ return Dot(this);
|
|
|
|
+ }
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Returns a copy of the quaternion, normalized to unit length.
|
|
/// Returns a copy of the quaternion, normalized to unit length.
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <returns>The normalized quaternion.</returns>
|
|
/// <returns>The normalized quaternion.</returns>
|
|
public readonly Quaternion Normalized()
|
|
public readonly Quaternion Normalized()
|
|
{
|
|
{
|
|
- return this / Length;
|
|
|
|
|
|
+ return this / Length();
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|