summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2021-11-04 10:58:20 -0500
committerAaron Franke <arnfranke@yahoo.com>2021-11-04 14:44:55 -0500
commit813466b3c893ce2d47098268475818d1e4e485b4 (patch)
treeb5f15a25d9680d88d08bb37f8afe67f5fc6fe3e9 /doc
parentee939c919b14a1935a0b6ccde338846a14cb9744 (diff)
Add documentation to operators for math types
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/AABB.xml5
-rw-r--r--doc/classes/Basis.xml7
-rw-r--r--doc/classes/Color.xml15
-rw-r--r--doc/classes/Plane.xml6
-rw-r--r--doc/classes/Quaternion.xml15
-rw-r--r--doc/classes/Rect2.xml5
-rw-r--r--doc/classes/Rect2i.xml2
-rw-r--r--doc/classes/Transform2D.xml9
-rw-r--r--doc/classes/Transform3D.xml8
-rw-r--r--doc/classes/Vector2.xml32
-rw-r--r--doc/classes/Vector2i.xml43
-rw-r--r--doc/classes/Vector3.xml34
-rw-r--r--doc/classes/Vector3i.xml43
-rw-r--r--doc/classes/float.xml13
-rw-r--r--doc/classes/int.xml6
15 files changed, 236 insertions, 7 deletions
diff --git a/doc/classes/AABB.xml b/doc/classes/AABB.xml
index d7b7a309ad..e7911be78b 100644
--- a/doc/classes/AABB.xml
+++ b/doc/classes/AABB.xml
@@ -218,12 +218,15 @@
<return type="bool" />
<argument index="0" name="right" type="AABB" />
<description>
+ Returns [code]true[/code] if the vectors are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="AABB" />
<argument index="0" name="right" type="Transform3D" />
<description>
+ Inversely transforms (multiplies) the [AABB] by the given [Transform3D] transformation matrix.
</description>
</operator>
<operator name="operator ==">
@@ -235,6 +238,8 @@
<return type="bool" />
<argument index="0" name="right" type="AABB" />
<description>
+ Returns [code]true[/code] if the AABBs are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
</operators>
diff --git a/doc/classes/Basis.xml b/doc/classes/Basis.xml
index 8ef9cd2e7c..f0bd2dfbcc 100644
--- a/doc/classes/Basis.xml
+++ b/doc/classes/Basis.xml
@@ -232,18 +232,22 @@
<return type="bool" />
<argument index="0" name="right" type="Basis" />
<description>
+ Returns [code]true[/code] if the [Basis] matrices are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="Basis" />
<argument index="0" name="right" type="Basis" />
<description>
+ Composes these two basis matrices by multiplying them together. This has the effect of transforming the second basis (the child) by the first basis (the parent).
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Transforms (multiplies) the [Vector3] by the given [Basis] matrix.
</description>
</operator>
<operator name="operator *">
@@ -269,12 +273,15 @@
<return type="bool" />
<argument index="0" name="right" type="Basis" />
<description>
+ Returns [code]true[/code] if the [Basis] matrices are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator []">
<return type="Vector3" />
<argument index="0" name="index" type="int" />
<description>
+ Access basis components using their index. [code]b[0][/code] is equivalent to [code]b.x[/code], [code]b[1][/code] is equivalent to [code]b.y[/code], and [code]b[2][/code] is equivalent to [code]b.z[/code].
</description>
</operator>
</operators>
diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml
index 71ec225cf6..c2c63efa37 100644
--- a/doc/classes/Color.xml
+++ b/doc/classes/Color.xml
@@ -863,54 +863,64 @@
<return type="bool" />
<argument index="0" name="right" type="Color" />
<description>
+ Returns [code]true[/code] if the colors are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="Color" />
<argument index="0" name="right" type="Color" />
<description>
+ Multiplies each component of the [Color] by the components of the given [Color].
</description>
</operator>
<operator name="operator *">
<return type="Color" />
<argument index="0" name="right" type="float" />
<description>
+ Multiplies each component of the [Color] by the given [float].
</description>
</operator>
<operator name="operator *">
<return type="Color" />
<argument index="0" name="right" type="int" />
<description>
+ Multiplies each component of the [Color] by the given [int].
</description>
</operator>
<operator name="operator +">
<return type="Color" />
<argument index="0" name="right" type="Color" />
<description>
+ Adds each component of the [Color] with the components of the given [Color].
</description>
</operator>
<operator name="operator -">
<return type="Color" />
<argument index="0" name="right" type="Color" />
<description>
+ Subtracts each component of the [Color] by the components of the given [Color].
</description>
</operator>
<operator name="operator /">
<return type="Color" />
<argument index="0" name="right" type="Color" />
<description>
+ Divides each component of the [Color] by the components of the given [Color].
</description>
</operator>
<operator name="operator /">
<return type="Color" />
<argument index="0" name="right" type="float" />
<description>
+ Divides each component of the [Color] by the given [float].
</description>
</operator>
<operator name="operator /">
<return type="Color" />
<argument index="0" name="right" type="int" />
<description>
+ Divides each component of the [Color] by the given [int].
</description>
</operator>
<operator name="operator ==">
@@ -922,22 +932,27 @@
<return type="bool" />
<argument index="0" name="right" type="Color" />
<description>
+ Returns [code]true[/code] if the colors are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator []">
<return type="float" />
<argument index="0" name="index" type="int" />
<description>
+ Access color components using their index. [code]c[0][/code] is equivalent to [code]c.r[/code], [code]c[1][/code] is equivalent to [code]c.g[/code], [code]c[2][/code] is equivalent to [code]c.b[/code], and [code]c[3][/code] is equivalent to [code]c.a[/code].
</description>
</operator>
<operator name="operator unary+">
<return type="Color" />
<description>
+ Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
</description>
</operator>
<operator name="operator unary-">
<return type="Color" />
<description>
+ Inverts the given color. This is equivalent to [code]Color.WHITE - c[/code] or [code]Color(1 - c.r, 1 - c.g, 1 - c.b, 1 - c.a)[/code].
</description>
</operator>
</operators>
diff --git a/doc/classes/Plane.xml b/doc/classes/Plane.xml
index a20607d0a7..11bbe2e553 100644
--- a/doc/classes/Plane.xml
+++ b/doc/classes/Plane.xml
@@ -180,6 +180,8 @@
<return type="bool" />
<argument index="0" name="right" type="Plane" />
<description>
+ Returns [code]true[/code] if the planes are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator ==">
@@ -191,16 +193,20 @@
<return type="bool" />
<argument index="0" name="right" type="Plane" />
<description>
+ Returns [code]true[/code] if the planes are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator unary+">
<return type="Plane" />
<description>
+ Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
</description>
</operator>
<operator name="operator unary-">
<return type="Plane" />
<description>
+ Returns the negative value of the [Plane]. This is the same as writing [code]Plane(-p.normal, -p.d)[/code]. This operation flips the direction of the normal vector and also flips the distance value, resulting in a Plane that is in the same place, but facing the opposite direction.
</description>
</operator>
</operators>
diff --git a/doc/classes/Quaternion.xml b/doc/classes/Quaternion.xml
index 95b2316bf3..4b787b31c7 100644
--- a/doc/classes/Quaternion.xml
+++ b/doc/classes/Quaternion.xml
@@ -195,54 +195,64 @@
<return type="bool" />
<argument index="0" name="right" type="Quaternion" />
<description>
+ Returns [code]true[/code] if the quaternions are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="Quaternion" />
<argument index="0" name="right" type="Quaternion" />
<description>
+ Composes these two quaternions by multiplying them together. This has the effect of rotating the second quaternion (the child) by the first quaternion (the parent).
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Rotates (multiplies) the [Vector3] by the given [Quaternion].
</description>
</operator>
<operator name="operator *">
<return type="Quaternion" />
<argument index="0" name="right" type="float" />
<description>
+ Multiplies each component of the [Quaternion] by the given value. This operation is not meaningful on its own, but it can be used as a part of a larger expression.
</description>
</operator>
<operator name="operator *">
<return type="Quaternion" />
<argument index="0" name="right" type="int" />
<description>
+ Multiplies each component of the [Quaternion] by the given value. This operation is not meaningful on its own, but it can be used as a part of a larger expression.
</description>
</operator>
<operator name="operator +">
<return type="Quaternion" />
<argument index="0" name="right" type="Quaternion" />
<description>
+ Adds each component of the left [Quaternion] to the right [Quaternion]. This operation is not meaningful on its own, but it can be used as a part of a larger expression, such as approximating an intermediate rotation between two nearby rotations.
</description>
</operator>
<operator name="operator -">
<return type="Quaternion" />
<argument index="0" name="right" type="Quaternion" />
<description>
+ Subtracts each component of the left [Quaternion] by the right [Quaternion]. This operation is not meaningful on its own, but it can be used as a part of a larger expression.
</description>
</operator>
<operator name="operator /">
<return type="Quaternion" />
<argument index="0" name="right" type="float" />
<description>
+ Divides each component of the [Quaternion] by the given value. This operation is not meaningful on its own, but it can be used as a part of a larger expression.
</description>
</operator>
<operator name="operator /">
<return type="Quaternion" />
<argument index="0" name="right" type="int" />
<description>
+ Divides each component of the [Quaternion] by the given value. This operation is not meaningful on its own, but it can be used as a part of a larger expression.
</description>
</operator>
<operator name="operator ==">
@@ -254,22 +264,27 @@
<return type="bool" />
<argument index="0" name="right" type="Quaternion" />
<description>
+ Returns [code]true[/code] if the quaternions are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator []">
<return type="float" />
<argument index="0" name="index" type="int" />
<description>
+ Access quaternion components using their index. [code]q[0][/code] is equivalent to [code]q.x[/code], [code]q[1][/code] is equivalent to [code]q.y[/code], [code]q[2][/code] is equivalent to [code]q.z[/code], and [code]q[3][/code] is equivalent to [code]q.w[/code].
</description>
</operator>
<operator name="operator unary+">
<return type="Quaternion" />
<description>
+ Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
</description>
</operator>
<operator name="operator unary-">
<return type="Quaternion" />
<description>
+ Returns the negative value of the [Quaternion]. This is the same as writing [code]Quaternion(-q.x, -q.y, -q.z, -q.w)[/code]. This operation results in a quaternion that represents the same rotation.
</description>
</operator>
</operators>
diff --git a/doc/classes/Rect2.xml b/doc/classes/Rect2.xml
index 01bec10ed8..becd1dd650 100644
--- a/doc/classes/Rect2.xml
+++ b/doc/classes/Rect2.xml
@@ -178,12 +178,15 @@
<return type="bool" />
<argument index="0" name="right" type="Rect2" />
<description>
+ Returns [code]true[/code] if the rectangles are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="Rect2" />
<argument index="0" name="right" type="Transform2D" />
<description>
+ Inversely transforms (multiplies) the [Rect2] by the given [Transform2D] transformation matrix.
</description>
</operator>
<operator name="operator ==">
@@ -195,6 +198,8 @@
<return type="bool" />
<argument index="0" name="right" type="Rect2" />
<description>
+ Returns [code]true[/code] if the rectangles are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
</operators>
diff --git a/doc/classes/Rect2i.xml b/doc/classes/Rect2i.xml
index fc27c64fa5..88a68c0455 100644
--- a/doc/classes/Rect2i.xml
+++ b/doc/classes/Rect2i.xml
@@ -169,6 +169,7 @@
<return type="bool" />
<argument index="0" name="right" type="Rect2i" />
<description>
+ Returns [code]true[/code] if the rectangles are not equal.
</description>
</operator>
<operator name="operator ==">
@@ -180,6 +181,7 @@
<return type="bool" />
<argument index="0" name="right" type="Rect2i" />
<description>
+ Returns [code]true[/code] if the rectangles are equal.
</description>
</operator>
</operators>
diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml
index ab7632e08e..5fa78b819c 100644
--- a/doc/classes/Transform2D.xml
+++ b/doc/classes/Transform2D.xml
@@ -213,30 +213,36 @@
<return type="bool" />
<argument index="0" name="right" type="Transform2D" />
<description>
+ Returns [code]true[/code] if the transforms are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="PackedVector2Array" />
<argument index="0" name="right" type="PackedVector2Array" />
<description>
+ Transforms (multiplies) each element of the [Vector2] array by the given [Transform2D] matrix.
</description>
</operator>
<operator name="operator *">
<return type="Transform2D" />
<argument index="0" name="right" type="Transform2D" />
<description>
+ Composes these two transformation matrices by multiplying them together. This has the effect of transforming the second transform (the child) by the first transform (the parent).
</description>
</operator>
<operator name="operator *">
<return type="Rect2" />
<argument index="0" name="right" type="Rect2" />
<description>
+ Transforms (multiplies) the [Rect2] by the given [Transform2D] matrix.
</description>
</operator>
<operator name="operator *">
<return type="Vector2" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Transforms (multiplies) the [Vector2] by the given [Transform2D] matrix.
</description>
</operator>
<operator name="operator *">
@@ -262,12 +268,15 @@
<return type="bool" />
<argument index="0" name="right" type="Transform2D" />
<description>
+ Returns [code]true[/code] if the transforms are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator []">
<return type="Vector2" />
<argument index="0" name="index" type="int" />
<description>
+ Access transform components using their index. [code]t[0][/code] is equivalent to [code]t.x[/code], [code]t[1][/code] is equivalent to [code]t.y[/code], and [code]t[2][/code] is equivalent to [code]t.origin[/code].
</description>
</operator>
</operators>
diff --git a/doc/classes/Transform3D.xml b/doc/classes/Transform3D.xml
index 8c4965abb4..94b20b05c6 100644
--- a/doc/classes/Transform3D.xml
+++ b/doc/classes/Transform3D.xml
@@ -147,30 +147,36 @@
<return type="bool" />
<argument index="0" name="right" type="Transform3D" />
<description>
+ Returns [code]true[/code] if the transforms are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="PackedVector3Array" />
<argument index="0" name="right" type="PackedVector3Array" />
<description>
+ Transforms (multiplies) each element of the [Vector3] array by the given [Transform3D] matrix.
</description>
</operator>
<operator name="operator *">
<return type="Transform3D" />
<argument index="0" name="right" type="Transform3D" />
<description>
+ Composes these two transformation matrices by multiplying them together. This has the effect of transforming the second transform (the child) by the first transform (the parent).
</description>
</operator>
<operator name="operator *">
<return type="AABB" />
<argument index="0" name="right" type="AABB" />
<description>
+ Transforms (multiplies) the [AABB] by the given [Transform3D] matrix.
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Transforms (multiplies) the [Vector3] by the given [Transform3D] matrix.
</description>
</operator>
<operator name="operator *">
@@ -196,6 +202,8 @@
<return type="bool" />
<argument index="0" name="right" type="Transform3D" />
<description>
+ Returns [code]true[/code] if the transforms are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
</operators>
diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml
index eaaf41561a..eb938bc2df 100644
--- a/doc/classes/Vector2.xml
+++ b/doc/classes/Vector2.xml
@@ -351,72 +351,97 @@
<return type="bool" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Returns [code]true[/code] if the vectors are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="Vector2" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Multiplies each component of the [Vector2] by the components of the given [Vector2].
+ [codeblock]
+ print(Vector2(10, 20) * Vector2(3, 4)) # Prints "(30, 80)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector2" />
<argument index="0" name="right" type="Transform2D" />
<description>
+ Inversely transforms (multiplies) the [Vector2] by the given [Transform2D] transformation matrix.
</description>
</operator>
<operator name="operator *">
<return type="Vector2" />
<argument index="0" name="right" type="float" />
<description>
+ Multiplies each component of the [Vector2] by the given [float].
</description>
</operator>
<operator name="operator *">
<return type="Vector2" />
<argument index="0" name="right" type="int" />
<description>
+ Multiplies each component of the [Vector2] by the given [int].
</description>
</operator>
<operator name="operator +">
<return type="Vector2" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Adds each component of the [Vector2] by the components of the given [Vector2].
+ [codeblock]
+ print(Vector2(10, 20) + Vector2(3, 4)) # Prints "(13, 24)"
+ [/codeblock]
</description>
</operator>
<operator name="operator -">
<return type="Vector2" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Subtracts each component of the [Vector2] by the components of the given [Vector2].
+ [codeblock]
+ print(Vector2(10, 20) - Vector2(3, 4)) # Prints "(7, 16)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector2" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Divides each component of the [Vector2] by the components of the given [Vector2].
+ [codeblock]
+ print(Vector2(10, 20) / Vector2(2, 5)) # Prints "(5, 4)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector2" />
<argument index="0" name="right" type="float" />
<description>
+ Divides each component of the [Vector2] by the given [float].
</description>
</operator>
<operator name="operator /">
<return type="Vector2" />
<argument index="0" name="right" type="int" />
<description>
+ Divides each component of the [Vector2] by the given [int].
</description>
</operator>
<operator name="operator &lt;">
<return type="bool" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Compares two [Vector2] vectors by first checking if the X value of the left vector is less than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &lt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Compares two [Vector2] vectors by first checking if the X value of the left vector is less than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator ==">
@@ -428,34 +453,41 @@
<return type="bool" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Returns [code]true[/code] if the vectors are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator &gt;">
<return type="bool" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Compares two [Vector2] vectors by first checking if the X value of the left vector is greater than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &gt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Compares two [Vector2] vectors by first checking if the X value of the left vector is greater than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator []">
<return type="float" />
<argument index="0" name="index" type="int" />
<description>
+ Access vector components using their index. [code]v[0][/code] is equivalent to [code]v.x[/code], and [code]v[1][/code] is equivalent to [code]v.y[/code].
</description>
</operator>
<operator name="operator unary+">
<return type="Vector2" />
<description>
+ Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
</description>
</operator>
<operator name="operator unary-">
<return type="Vector2" />
<description>
+ Returns the negative value of the [Vector2]. This is the same as writing [code]Vector2(-v.x, -v.y)[/code]. This operation flips the direction of the vector while keeping the same magnitude. With floats, the number zero can be either positive or negative.
</description>
</operator>
</operators>
diff --git a/doc/classes/Vector2i.xml b/doc/classes/Vector2i.xml
index 71882e5b0c..2744d09f1d 100644
--- a/doc/classes/Vector2i.xml
+++ b/doc/classes/Vector2i.xml
@@ -115,78 +115,115 @@
<return type="bool" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Returns [code]true[/code] if the vectors are not equal.
</description>
</operator>
<operator name="operator %">
<return type="Vector2i" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Gets the remainder of each component of the [Vector2i] with the components of the given [Vector2i]. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using [method @GlobalScope.posmod] instead if you want to handle negative numbers.
+ [codeblock]
+ print(Vector2i(10, -20) % Vector2i(7, 8)) # Prints "(3, -4)"
+ [/codeblock]
</description>
</operator>
<operator name="operator %">
<return type="Vector2i" />
<argument index="0" name="right" type="int" />
<description>
+ Gets the remainder of each component of the [Vector2i] with the the given [int]. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using [method @GlobalScope.posmod] instead if you want to handle negative numbers.
+ [codeblock]
+ print(Vector2i(10, -20) % 7) # Prints "(3, -6)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector2i" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Multiplies each component of the [Vector2i] by the components of the given [Vector2i].
+ [codeblock]
+ print(Vector2i(10, 20) * Vector2i(3, 4)) # Prints "(30, 80)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector2i" />
<argument index="0" name="right" type="float" />
<description>
+ Multiplies each component of the [Vector2i] by the given [float] truncated to an integer.
+ [codeblock]
+ print(Vector2i(10, 20) * 0.9) # Prints "(0, 0)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector2i" />
<argument index="0" name="right" type="int" />
<description>
+ Multiplies each component of the [Vector2i] by the given [int].
</description>
</operator>
<operator name="operator +">
<return type="Vector2i" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Adds each component of the [Vector2i] by the components of the given [Vector2i].
+ [codeblock]
+ print(Vector2i(10, 20) + Vector2i(3, 4)) # Prints "(13, 24)"
+ [/codeblock]
</description>
</operator>
<operator name="operator -">
<return type="Vector2i" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Subtracts each component of the [Vector2i] by the components of the given [Vector2i].
+ [codeblock]
+ print(Vector2i(10, 20) - Vector2i(3, 4)) # Prints "(7, 16)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector2i" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Divides each component of the [Vector2i] by the components of the given [Vector2i].
+ [codeblock]
+ print(Vector2i(10, 20) / Vector2i(2, 5)) # Prints "(5, 4)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector2i" />
<argument index="0" name="right" type="float" />
<description>
+ Divides each component of the [Vector2i] by the given [float] truncated to an integer.
+ [codeblock]
+ print(Vector2i(10, 20) / 2.9) # Prints "(5, 10)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector2i" />
<argument index="0" name="right" type="int" />
<description>
+ Divides each component of the [Vector2i] by the given [int].
</description>
</operator>
<operator name="operator &lt;">
<return type="bool" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Compares two [Vector2i] vectors by first checking if the X value of the left vector is less than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &lt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Compares two [Vector2i] vectors by first checking if the X value of the left vector is less than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator ==">
@@ -198,34 +235,40 @@
<return type="bool" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Returns [code]true[/code] if the vectors are equal.
</description>
</operator>
<operator name="operator &gt;">
<return type="bool" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Compares two [Vector2i] vectors by first checking if the X value of the left vector is greater than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &gt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Compares two [Vector2i] vectors by first checking if the X value of the left vector is greater than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator []">
<return type="int" />
<argument index="0" name="index" type="int" />
<description>
+ Access vector components using their index. [code]v[0][/code] is equivalent to [code]v.x[/code], and [code]v[1][/code] is equivalent to [code]v.y[/code].
</description>
</operator>
<operator name="operator unary+">
<return type="Vector2i" />
<description>
+ Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
</description>
</operator>
<operator name="operator unary-">
<return type="Vector2i" />
<description>
+ Returns the negative value of the [Vector2i]. This is the same as writing [code]Vector2i(-v.x, -v.y)[/code]. This operation flips the direction of the vector while keeping the same magnitude.
</description>
</operator>
</operators>
diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml
index a94cc0086f..5e2ce380a7 100644
--- a/doc/classes/Vector3.xml
+++ b/doc/classes/Vector3.xml
@@ -367,84 +367,111 @@
<return type="bool" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Returns [code]true[/code] if the vectors are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Multiplies each component of the [Vector3] by the components of the given [Vector3].
+ [codeblock]
+ print(Vector3(10, 20, 30) * Vector3(3, 4, 5)) # Prints "(30, 80, 150)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="Basis" />
<description>
+ Inversely transforms (multiplies) the [Vector3] by the given [Basis] matrix.
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="Quaternion" />
<description>
+ Inversely transforms (multiplies) the [Vector3] by the given [Quaternion].
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="Transform3D" />
<description>
+ Inversely transforms (multiplies) the [Vector3] by the given [Transform3D] transformation matrix.
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="float" />
<description>
+ Multiplies each component of the [Vector3] by the given [float].
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="int" />
<description>
+ Multiplies each component of the [Vector3] by the given [int].
</description>
</operator>
<operator name="operator +">
<return type="Vector3" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Adds each component of the [Vector3] by the components of the given [Vector3].
+ [codeblock]
+ print(Vector3(10, 20, 30) + Vector3(3, 4, 5)) # Prints "(13, 24, 35)"
+ [/codeblock]
</description>
</operator>
<operator name="operator -">
<return type="Vector3" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Subtracts each component of the [Vector3] by the components of the given [Vector3].
+ [codeblock]
+ print(Vector3(10, 20, 30) - Vector3(3, 4, 5)) # Prints "(7, 16, 25)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector3" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Divides each component of the [Vector3] by the components of the given [Vector3].
+ [codeblock]
+ print(Vector3(10, 20, 30) / Vector3(2, 5, 3)) # Prints "(5, 4, 10)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector3" />
<argument index="0" name="right" type="float" />
<description>
+ Divides each component of the [Vector3] by the given [float].
</description>
</operator>
<operator name="operator /">
<return type="Vector3" />
<argument index="0" name="right" type="int" />
<description>
+ Divides each component of the [Vector3] by the given [int].
</description>
</operator>
<operator name="operator &lt;">
<return type="bool" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Compares two [Vector3] vectors by first checking if the X value of the left vector is less than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &lt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Compares two [Vector3] vectors by first checking if the X value of the left vector is less than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator ==">
@@ -456,34 +483,41 @@
<return type="bool" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Returns [code]true[/code] if the vectors are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator &gt;">
<return type="bool" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Compares two [Vector3] vectors by first checking if the X value of the left vector is greater than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &gt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Compares two [Vector3] vectors by first checking if the X value of the left vector is greater than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator []">
<return type="float" />
<argument index="0" name="index" type="int" />
<description>
+ Access vector components using their index. [code]v[0][/code] is equivalent to [code]v.x[/code], [code]v[1][/code] is equivalent to [code]v.y[/code], and [code]v[2][/code] is equivalent to [code]v.z[/code].
</description>
</operator>
<operator name="operator unary+">
<return type="Vector3" />
<description>
+ Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
</description>
</operator>
<operator name="operator unary-">
<return type="Vector3" />
<description>
+ Returns the negative value of the [Vector3]. This is the same as writing [code]Vector3(-v.x, -v.y, -v.z)[/code]. This operation flips the direction of the vector while keeping the same magnitude. With floats, the number zero can be either positive or negative.
</description>
</operator>
</operators>
diff --git a/doc/classes/Vector3i.xml b/doc/classes/Vector3i.xml
index 5cd458a2be..d56d6a2859 100644
--- a/doc/classes/Vector3i.xml
+++ b/doc/classes/Vector3i.xml
@@ -133,78 +133,115 @@
<return type="bool" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Returns [code]true[/code] if the vectors are not equal.
</description>
</operator>
<operator name="operator %">
<return type="Vector3i" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Gets the remainder of each component of the [Vector3i] with the components of the given [Vector3i]. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using [method @GlobalScope.posmod] instead if you want to handle negative numbers.
+ [codeblock]
+ print(Vector3i(10, -20, 30) % Vector3i(7, 8, 9)) # Prints "(3, -4, 3)"
+ [/codeblock]
</description>
</operator>
<operator name="operator %">
<return type="Vector3i" />
<argument index="0" name="right" type="int" />
<description>
+ Gets the remainder of each component of the [Vector3i] with the the given [int]. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using [method @GlobalScope.posmod] instead if you want to handle negative numbers.
+ [codeblock]
+ print(Vector2i(10, -20, 30) % 7) # Prints "(3, -6, 2)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector3i" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Multiplies each component of the [Vector3i] by the components of the given [Vector3i].
+ [codeblock]
+ print(Vector3i(10, 20, 30) * Vector3i(3, 4, 5)) # Prints "(30, 80, 150)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector3i" />
<argument index="0" name="right" type="float" />
<description>
+ Multiplies each component of the [Vector3i] by the given [float] truncated to an integer.
+ [codeblock]
+ print(Vector3i(10, 20, 30) * 0.9) # Prints "(0, 0, 0)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector3i" />
<argument index="0" name="right" type="int" />
<description>
+ Multiplies each component of the [Vector3i] by the given [int].
</description>
</operator>
<operator name="operator +">
<return type="Vector3i" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Adds each component of the [Vector3i] by the components of the given [Vector3i].
+ [codeblock]
+ print(Vector3i(10, 20, 30) + Vector3i(3, 4, 5)) # Prints "(13, 24, 35)"
+ [/codeblock]
</description>
</operator>
<operator name="operator -">
<return type="Vector3i" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Subtracts each component of the [Vector3i] by the components of the given [Vector3i].
+ [codeblock]
+ print(Vector3i(10, 20, 30) - Vector3i(3, 4, 5)) # Prints "(7, 16, 25)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector3i" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Divides each component of the [Vector3i] by the components of the given [Vector3i].
+ [codeblock]
+ print(Vector3i(10, 20, 30) / Vector3i(2, 5, 3)) # Prints "(5, 4, 10)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector3i" />
<argument index="0" name="right" type="float" />
<description>
+ Divides each component of the [Vector3i] by the given [float] truncated to an integer.
+ [codeblock]
+ print(Vector3i(10, 20, 30) / 2.9) # Prints "(5, 10, 15)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector3i" />
<argument index="0" name="right" type="int" />
<description>
+ Divides each component of the [Vector3i] by the given [int].
</description>
</operator>
<operator name="operator &lt;">
<return type="bool" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Compares two [Vector3i] vectors by first checking if the X value of the left vector is less than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &lt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Compares two [Vector3i] vectors by first checking if the X value of the left vector is less than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator ==">
@@ -216,34 +253,40 @@
<return type="bool" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Returns [code]true[/code] if the vectors are equal.
</description>
</operator>
<operator name="operator &gt;">
<return type="bool" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Compares two [Vector3i] vectors by first checking if the X value of the left vector is greater than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &gt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Compares two [Vector3i] vectors by first checking if the X value of the left vector is greater than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator []">
<return type="int" />
<argument index="0" name="index" type="int" />
<description>
+ Access vector components using their index. [code]v[0][/code] is equivalent to [code]v.x[/code], [code]v[1][/code] is equivalent to [code]v.y[/code], and [code]v[2][/code] is equivalent to [code]v.z[/code].
</description>
</operator>
<operator name="operator unary+">
<return type="Vector3i" />
<description>
+ Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
</description>
</operator>
<operator name="operator unary-">
<return type="Vector3i" />
<description>
+ Returns the negative value of the [Vector3i]. This is the same as writing [code]Vector3i(-v.x, -v.y, -v.z)[/code]. This operation flips the direction of the vector while keeping the same magnitude.
</description>
</operator>
</operators>
diff --git a/doc/classes/float.xml b/doc/classes/float.xml
index 8231173bac..c96360e6ba 100644
--- a/doc/classes/float.xml
+++ b/doc/classes/float.xml
@@ -72,7 +72,7 @@
<return type="Quaternion" />
<argument index="0" name="right" type="Quaternion" />
<description>
- Multiplies each component of the [Quaternion] by the given [float].
+ Multiplies each component of the [Quaternion] by the given [float]. This operation is not meaningful on its own, but it can be used as a part of a larger expression.
</description>
</operator>
<operator name="operator *">
@@ -81,7 +81,7 @@
<description>
Multiplies each component of the [Vector2] by the given [float].
[codeblock]
- print(2.5 * Vector2(1, 1)) # Vector2(2.5, 2.5)
+ print(2.5 * Vector2(1, 3)) # Prints "(2.5, 7.5)"
[/codeblock]
</description>
</operator>
@@ -89,9 +89,9 @@
<return type="Vector2i" />
<argument index="0" name="right" type="Vector2i" />
<description>
- Multiplies each component of the [Vector2i] by the given [float].
+ Multiplies each component of the [Vector2i] by the given [float] truncated to an integer.
[codeblock]
- print(2.0 * Vector2i(1, 1)) # Vector2i(2.0, 2.0)
+ print(0.9 * Vector2i(10, 20)) # Prints "(0, 0)"
[/codeblock]
</description>
</operator>
@@ -106,7 +106,10 @@
<return type="Vector3i" />
<argument index="0" name="right" type="Vector3i" />
<description>
- Multiplies each component of the [Vector3i] by the given [float].
+ Multiplies each component of the [Vector3i] by the given [float] truncated to an integer.
+ [codeblock]
+ print(0.9 * Vector3i(10, 20, 30)) # Prints "(0, 0, 0)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
diff --git a/doc/classes/int.xml b/doc/classes/int.xml
index 94c2601e4a..bb36d83741 100644
--- a/doc/classes/int.xml
+++ b/doc/classes/int.xml
@@ -91,11 +91,11 @@
<return type="int" />
<argument index="0" name="right" type="int" />
<description>
- Returns the result of the modulo operator for two integers, i.e. the remainder after dividing both numbers.
+ Returns the remainder after dividing two integers. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using [method @GlobalScope.posmod] instead if you want to handle negative numbers.
[codeblock]
print(5 % 2) # 1
print(12 % 4) # 0
- print(12 % 2) # 2
+ print(-5 % 3) # -2
[/codeblock]
</description>
</operator>
@@ -121,12 +121,14 @@
<return type="Color" />
<argument index="0" name="right" type="Color" />
<description>
+ Multiplies each component of the [Color] by the given [int].
</description>
</operator>
<operator name="operator *">
<return type="Quaternion" />
<argument index="0" name="right" type="Quaternion" />
<description>
+ Multiplies each component of the [Quaternion] by the given [int]. This operation is not meaningful on its own, but it can be used as a part of a larger expression.
</description>
</operator>
<operator name="operator *">