-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quaternion Documentation: Describe edge cases #87422
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -39,7 +39,8 @@ | |||||
<param index="0" name="axis" type="Vector3" /> | ||||||
<param index="1" name="angle" type="float" /> | ||||||
<description> | ||||||
Constructs a quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector. | ||||||
Constructs a quaternion that will rotate around the given axis by the specified angle. | ||||||
[b]Note:[/b] The axis must be a normalized vector. Returns [code](0, 0, 0, 1)[/code] if your vector is not normalized in Debug mode. Returns the quaternion that would have been generated by normalizing the axis in release mode. If the axis has length [code]0[/code] and therefore cannot be normalized returns [code](0, 0, 0, 0)[/code] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
</description> | ||||||
</constructor> | ||||||
<constructor name="Quaternion"> | ||||||
|
@@ -93,7 +94,7 @@ | |||||
<return type="float" /> | ||||||
<description> | ||||||
Returns the angle of the rotation represented by this quaternion. | ||||||
[b]Note:[/b] The quaternion must be normalized. | ||||||
[b]Note:[/b] The quaternion must be normalized. Returns [code]0[/code] if the quaternion has a length and is not normalized. Returns [code]PI[/code] if the quaternion has no length and is not normalized. | ||||||
</description> | ||||||
</method> | ||||||
<method name="get_axis" qualifiers="const"> | ||||||
|
@@ -156,6 +157,7 @@ | |||||
<return type="Quaternion" /> | ||||||
<description> | ||||||
Returns a copy of the quaternion, normalized to unit length. | ||||||
[b]Note:[/b] Must have a length that does not equal [code]0[/code]. Returns [code](nan, nan, nan, nan)[/code] if you normalize a quaternion with no length. | ||||||
</description> | ||||||
</method> | ||||||
<method name="slerp" qualifiers="const"> | ||||||
|
@@ -164,7 +166,7 @@ | |||||
<param index="1" name="weight" type="float" /> | ||||||
<description> | ||||||
Returns the result of the spherical linear interpolation between this quaternion and [param to] by amount [param weight]. | ||||||
[b]Note:[/b] Both quaternions must be normalized. | ||||||
[b]Note:[/b] Both quaternions must be normalized. Returns [code](0, 0, 0, 1)[/code] if any quaternion is not normalized in debug mode. Returns [code]self[/code] if any quaternion is not normalized in release mode. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In this situation the class reference likes to say, for example "Returns this quaternion unchanged" or "Returns the quaternion without changes" or similar. |
||||||
</description> | ||||||
</method> | ||||||
<method name="slerpni" qualifiers="const"> | ||||||
|
@@ -173,6 +175,7 @@ | |||||
<param index="1" name="weight" type="float" /> | ||||||
<description> | ||||||
Returns the result of the spherical linear interpolation between this quaternion and [param to] by amount [param weight], but without checking if the rotation path is not bigger than 90 degrees. | ||||||
[b]Note:[/b] Both quaternions must be normalized. Returns [code](0, 0, 0, 1)[/code] if any quaternion is not normalized in debug mode. Returns [code]self[/code] if any quaternion is not normalized in release mode. | ||||||
</description> | ||||||
</method> | ||||||
<method name="spherical_cubic_interpolate" qualifiers="const"> | ||||||
|
@@ -183,6 +186,7 @@ | |||||
<param index="3" name="weight" type="float" /> | ||||||
<description> | ||||||
Performs a spherical cubic interpolation between quaternions [param pre_a], this vector, [param b], and [param post_b], by the given amount [param weight]. | ||||||
[b]Note:[/b] All quaternions must be normalized. Returns [code](0, 0, 0, 1)[/code] if any quaternion is not normalized in debug mode. Returns [code]self[/code] if any quaternion is not normalized in release mode. | ||||||
</description> | ||||||
</method> | ||||||
<method name="spherical_cubic_interpolate_in_time" qualifiers="const"> | ||||||
|
@@ -197,6 +201,7 @@ | |||||
<description> | ||||||
Performs a spherical cubic interpolation between quaternions [param pre_a], this vector, [param b], and [param post_b], by the given amount [param weight]. | ||||||
It can perform smoother interpolation than [method spherical_cubic_interpolate] by the time values. | ||||||
[b]Note:[/b] All quaternions must be normalized. Returns [code](0, 0, 0, 1)[/code] if any quaternion is not normalized in debug mode. Returns [code]self[/code] if any quaternion is not normalized in release mode. | ||||||
</description> | ||||||
</method> | ||||||
</methods> | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do trust that this is all correct, as it is way out of my expertise. I heavily appreciate the extra detail.
However, the way this entire note and others are structured in this PR is extremely inconsistent and kind of "not good" for several reasons:
(0, 0, 0, 1)
is the IDENTITY Quaternion and should be referred to as such (Returns [constant IDENTITY]
) to point users in the right direction, as it is not an arbitrary, magic value."Returns the quaternion that would have been generated by normalizing the axis in release mode."
This means that it's only worth noting the more "unusual" behavior in debug builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the feedback. I'll make those modifications. Great work on your documentation improvements by the way.