Skip to content

Commit

Permalink
Merge pull request #83461 from kleonc/docs-multiplication-operators-d…
Browse files Browse the repository at this point in the history
…oing-xform_inv

Clarify docs for operators performing `xform_inv`
  • Loading branch information
akien-mga committed Oct 17, 2023
2 parents 837f091 + a8c62c5 commit 8ff8d41
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 13 deletions.
4 changes: 3 additions & 1 deletion doc/classes/AABB.xml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@
<return type="AABB" />
<param index="0" name="right" type="Transform3D" />
<description>
Inversely transforms (multiplies) the [AABB] by the given [Transform3D] transformation matrix.
Inversely transforms (multiplies) the [AABB] by the given [Transform3D] transformation matrix, under the assumption that the transformation basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not).
[code]aabb * transform[/code] is equivalent to [code]transform.inverse() * aabb[/code]. See [method Transform3D.inverse].
For transforming by inverse of an affine transformation (e.g. with scaling) [code]transform.affine_inverse() * aabb[/code] can be used instead. See [method Transform3D.affine_inverse].
</description>
</operator>
<operator name="operator ==">
Expand Down
4 changes: 3 additions & 1 deletion doc/classes/PackedVector2Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@
<return type="PackedVector2Array" />
<param index="0" name="right" type="Transform2D" />
<description>
Transforms (multiplies) all vectors in the array by the [Transform2D] matrix.
Returns a new [PackedVector2Array] with all vectors in this array inversely transformed (multiplied) by the given [Transform2D] transformation matrix, under the assumption that the transformation basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not).
[code]array * transform[/code] is equivalent to [code]transform.inverse() * array[/code]. See [method Transform2D.inverse].
For transforming by inverse of an affine transformation (e.g. with scaling) [code]transform.affine_inverse() * array[/code] can be used instead. See [method Transform2D.affine_inverse].
</description>
</operator>
<operator name="operator +">
Expand Down
4 changes: 3 additions & 1 deletion doc/classes/PackedVector3Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@
<return type="PackedVector3Array" />
<param index="0" name="right" type="Transform3D" />
<description>
Transforms (multiplies) all vectors in the array by the [Transform3D] matrix.
Returns a new [PackedVector3Array] with all vectors in this array inversely transformed (multiplied) by the given [Transform3D] transformation matrix, under the assumption that the transformation basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not).
[code]array * transform[/code] is equivalent to [code]transform.inverse() * array[/code]. See [method Transform3D.inverse].
For transforming by inverse of an affine transformation (e.g. with scaling) [code]transform.affine_inverse() * array[/code] can be used instead. See [method Transform3D.affine_inverse].
</description>
</operator>
<operator name="operator +">
Expand Down
1 change: 1 addition & 0 deletions doc/classes/Plane.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
<param index="0" name="right" type="Transform3D" />
<description>
Inversely transforms (multiplies) the [Plane] by the given [Transform3D] transformation matrix.
[code]plane * transform[/code] is equivalent to [code]transform.affine_inverse() * plane[/code]. See [method Transform3D.affine_inverse].
</description>
</operator>
<operator name="operator ==">
Expand Down
4 changes: 3 additions & 1 deletion doc/classes/Rect2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@
<return type="Rect2" />
<param index="0" name="right" type="Transform2D" />
<description>
Inversely transforms (multiplies) the [Rect2] by the given [Transform2D] transformation matrix.
Inversely transforms (multiplies) the [Rect2] by the given [Transform2D] transformation matrix, under the assumption that the transformation basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not).
[code]rect * transform[/code] is equivalent to [code]transform.inverse() * rect[/code]. See [method Transform2D.inverse].
For transforming by inverse of an affine transformation (e.g. with scaling) [code]transform.affine_inverse() * rect[/code] can be used instead. See [method Transform2D.affine_inverse].
</description>
</operator>
<operator name="operator ==">
Expand Down
8 changes: 5 additions & 3 deletions doc/classes/Transform2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<method name="affine_inverse" qualifiers="const">
<return type="Transform2D" />
<description>
Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation.
Returns the inverse of the transform, under the assumption that the basis is invertible (must have non-zero determinant).
</description>
</method>
<method name="basis_xform" qualifiers="const">
Expand All @@ -74,8 +74,10 @@
<return type="Vector2" />
<param index="0" name="v" type="Vector2" />
<description>
Returns a vector transformed (multiplied) by the inverse basis matrix.
Returns a vector transformed (multiplied) by the inverse basis matrix, under the assumption that the basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not).
This method does not account for translation (the origin vector).
[code]transform.basis_xform_inv(vector)[/code] is equivalent to [code]transform.inverse().basis_xform(vector)[/code]. See [method inverse].
For non-orthonormal transforms (e.g. with scaling) use [code]transform.affine_inverse().basis_xform(vector)[/code] instead. See [method affine_inverse].
</description>
</method>
<method name="determinant" qualifiers="const">
Expand Down Expand Up @@ -120,7 +122,7 @@
<method name="inverse" qualifiers="const">
<return type="Transform2D" />
<description>
Returns the inverse of the transform, under the assumption that the transformation is composed of rotation and translation (no scaling, use [method affine_inverse] for transforms with scaling).
Returns the inverse of the transform, under the assumption that the transformation basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not). Use [method affine_inverse] for non-orthonormal transforms (e.g. with scaling).
</description>
</method>
<method name="is_conformal" qualifiers="const">
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/Transform3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<method name="affine_inverse" qualifiers="const">
<return type="Transform3D" />
<description>
Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation.
Returns the inverse of the transform, under the assumption that the basis is invertible (must have non-zero determinant).
</description>
</method>
<method name="interpolate_with" qualifiers="const">
Expand All @@ -73,7 +73,7 @@
<method name="inverse" qualifiers="const">
<return type="Transform3D" />
<description>
Returns the inverse of the transform, under the assumption that the transformation is composed of rotation and translation (no scaling, use [method affine_inverse] for transforms with scaling).
Returns the inverse of the transform, under the assumption that the transformation basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not). Use [method affine_inverse] for non-orthonormal transforms (e.g. with scaling).
</description>
</method>
<method name="is_equal_approx" qualifiers="const">
Expand Down
4 changes: 3 additions & 1 deletion doc/classes/Vector2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,9 @@
<return type="Vector2" />
<param index="0" name="right" type="Transform2D" />
<description>
Inversely transforms (multiplies) the [Vector2] by the given [Transform2D] transformation matrix.
Inversely transforms (multiplies) the [Vector2] by the given [Transform2D] transformation matrix, under the assumption that the transformation basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not).
[code]vector * transform[/code] is equivalent to [code]transform.inverse() * vector[/code]. See [method Transform2D.inverse].
For transforming by inverse of an affine transformation (e.g. with scaling) [code]transform.affine_inverse() * vector[/code] can be used instead. See [method Transform2D.affine_inverse].
</description>
</operator>
<operator name="operator *">
Expand Down
9 changes: 7 additions & 2 deletions doc/classes/Vector3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -442,21 +442,26 @@
<return type="Vector3" />
<param index="0" name="right" type="Basis" />
<description>
Inversely transforms (multiplies) the [Vector3] by the given [Basis] matrix.
Inversely transforms (multiplies) the [Vector3] by the given [Basis] matrix, under the assumption that the basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not).
[code]vector * basis[/code] is equivalent to [code]basis.transposed() * vector[/code]. See [method Basis.transposed].
For transforming by inverse of a non-orthonormal basis [code]basis.inverse() * vector[/code] can be used instead. See [method Basis.inverse].
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<param index="0" name="right" type="Quaternion" />
<description>
Inversely transforms (multiplies) the [Vector3] by the given [Quaternion].
[code]vector * quaternion[/code] is equivalent to [code]quaternion.inverse() * vector[/code]. See [method Quaternion.inverse].
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<param index="0" name="right" type="Transform3D" />
<description>
Inversely transforms (multiplies) the [Vector3] by the given [Transform3D] transformation matrix.
Inversely transforms (multiplies) the [Vector3] by the given [Transform3D] transformation matrix, under the assumption that the transformation basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not).
[code]vector * transform[/code] is equivalent to [code]transform.inverse() * vector[/code]. See [method Transform3D.inverse].
For transforming by inverse of an affine transformation (e.g. with scaling) [code]transform.affine_inverse() * vector[/code] can be used instead. See [method Transform3D.affine_inverse].
</description>
</operator>
<operator name="operator *">
Expand Down
3 changes: 2 additions & 1 deletion doc/classes/Vector4.xml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@
<return type="Vector4" />
<param index="0" name="right" type="Projection" />
<description>
Inversely transforms (multiplies) the [Vector4] by the given [Projection] matrix.
Transforms (multiplies) the [Vector4] by the transpose of the given [Projection] matrix.
For transforming by inverse of a projection [code]projection.inverse() * vector[/code] can be used instead. See [method Projection.inverse].
</description>
</operator>
<operator name="operator *">
Expand Down

0 comments on commit 8ff8d41

Please sign in to comment.