Skip to content

Commit

Permalink
Make Transform2D/3D, Basis, and Quaternion docs more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickeon committed Nov 24, 2024
1 parent cb411fa commit 296a30d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
9 changes: 5 additions & 4 deletions doc/classes/Basis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<constructor name="Basis">
<return type="Basis" />
<description>
Constructs a [Basis] identical to the [constant IDENTITY].
Constructs a [Basis] identical to [constant IDENTITY].
[b]Note:[/b] In C#, this constructs a [Basis] with all of its components set to [constant Vector3.ZERO].
</description>
</constructor>
Expand Down Expand Up @@ -131,6 +131,7 @@
- The [member Vector3.y] contains the angle around the [member y] axis (yaw);
- The [member Vector3.z] contains the angle around the [member z] axis (roll).
The order of each consecutive rotation can be changed with [param order] (see [enum EulerOrder] constants). By default, the YXZ convention is used ([constant EULER_ORDER_YXZ]): Z (roll) is calculated first, then X (pitch), and lastly Y (yaw). When using the opposite method [method from_euler], this order is reversed.
[b]Note:[/b] This method assumes the basis is [i]uniform[/i] (all axes share the same length) (see [method get_scale]).
[b]Note:[/b] Euler angles are much more intuitive but are not suitable for 3D math. Because of this, consider using the [method get_rotation_quaternion] method instead, which returns a [Quaternion].
[b]Note:[/b] In the Inspector dock, a basis's rotation is often displayed in Euler angles (in degrees), as is the case with the [member Node3D.rotation] property.
</description>
Expand All @@ -145,7 +146,7 @@
<method name="get_scale" qualifiers="const">
<return type="Vector3" />
<description>
Returns the length of each axis of this basis, as a [Vector3]. If the basis is not sheared, this is the scaling factor. It is not affected by rotation.
Returns the length of each axis of this basis, as a [Vector3]. If the basis is not sheared, this value is the scaling factor. It is not affected by rotation.
[codeblocks]
[gdscript]
var my_basis = Basis(
Expand Down Expand Up @@ -242,8 +243,8 @@
<param index="0" name="axis" type="Vector3" />
<param index="1" name="angle" type="float" />
<description>
Returns this basis rotated around the given [param axis] by [param angle] (in radians). The [param axis] must be a normalized vector (see [method Vector3.normalized]).
Positive values rotate this basis clockwise around the axis, while negative values rotate it counterclockwise.
Returns a copy of this basis rotated around the given [param axis] by the given [param angle] (in radians).
The [param axis] must be a normalized vector (see [method Vector3.normalized]). If [param angle] is positive, the basis is rotated clockwise around the axis.
[codeblocks]
[gdscript]
var my_basis = Basis.IDENTITY
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/Quaternion.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<constructor name="Quaternion">
<return type="Quaternion" />
<description>
Constructs a [Quaternion] identical to the [constant IDENTITY].
Constructs a [Quaternion] identical to [constant IDENTITY].
[b]Note:[/b] In C#, this constructs a [Quaternion] with all of its components set to [code]0.0[/code].
</description>
</constructor>
Expand Down
5 changes: 3 additions & 2 deletions doc/classes/Transform2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
// Rotating the Transform2D in any way preserves its scale.
myTransform = myTransform.Rotated(Mathf.Tau / 2.0f);

GD.Print(myTransform.GetScale()); // Prints (2, 4, 8).
GD.Print(myTransform.GetScale()); // Prints (2, 4).
[/csharp]
[/codeblocks]
[b]Note:[/b] If the value returned by [method determinant] is negative, the scale is also negative.
Expand Down Expand Up @@ -191,7 +191,8 @@
<return type="Transform2D" />
<param index="0" name="angle" type="float" />
<description>
Returns a copy of the transform rotated by the given [param angle] (in radians).
Returns a copy of this transform rotated by the given [param angle] (in radians).
If [param angle] is positive, the transform is rotated clockwise.
This method is an optimized version of multiplying the given transform [code]X[/code] with a corresponding rotation transform [code]R[/code] from the left, i.e., [code]R * X[/code].
This can be seen as transforming with respect to the global/parent frame.
</description>
Expand Down
10 changes: 5 additions & 5 deletions doc/classes/Transform3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<constructor name="Transform3D">
<return type="Transform3D" />
<description>
Constructs a [Transform3D] identical to the [constant IDENTITY].
Constructs a [Transform3D] identical to [constant IDENTITY].
[b]Note:[/b] In C#, this constructs a [Transform3D] with its [member origin] and the components of its [member basis] set to [constant Vector3.ZERO].
</description>
</constructor>
Expand Down Expand Up @@ -62,7 +62,7 @@
<method name="affine_inverse" qualifiers="const">
<return type="Transform3D" />
<description>
Returns the inverted version of this transform. Unlike [method inverse], this method works with almost any [member basis], including non-uniform ones, but is slower. See also [method Basis.inverse].
Returns the inverted version of this transform. Unlike [method inverse], this method works with almost any [member basis], including non-uniform ones, but is slower. See also [method inverse].
[b]Note:[/b] For this method to return correctly, the transform's [member basis] needs to have a determinant that is not exactly [code]0[/code] (see [method Basis.determinant]).
</description>
</method>
Expand All @@ -78,8 +78,8 @@
<method name="inverse" qualifiers="const">
<return type="Transform3D" />
<description>
Returns the inverted version of this transform. See also [method Basis.inverse].
[b]Note:[/b] For this method to return correctly, the transform's [member basis] needs to be [i]orthonormal[/i] (see [method Basis.orthonormalized]). That means, the basis should only represent a rotation. If it does not, use [method affine_inverse] instead.
Returns the [url=https://en.wikipedia.org/wiki/Invertible_matrix]inverted version of this transform[/url]. See also [method Basis.inverse].
[b]Note:[/b] For this method to return correctly, the transform's [member basis] needs to be [i]orthonormal[/i] (see [method orthonormalized]). That means, the basis should only represent a rotation. If it does not, use [method affine_inverse] instead.
</description>
</method>
<method name="is_equal_approx" qualifiers="const">
Expand Down Expand Up @@ -118,7 +118,7 @@
<param index="1" name="angle" type="float" />
<description>
Returns a copy of this transform rotated around the given [param axis] by the given [param angle] (in radians).
The [param axis] must be a normalized vector.
The [param axis] must be a normalized vector (see [method Vector3.normalized]). If [param angle] is positive, the basis is rotated clockwise around the axis.
This method is an optimized version of multiplying the given transform [code]X[/code] with a corresponding rotation transform [code]R[/code] from the left, i.e., [code]R * X[/code].
This can be seen as transforming with respect to the global/parent frame.
</description>
Expand Down

0 comments on commit 296a30d

Please sign in to comment.