From ad12d466cc7bbbbcc9e3e591ae62e870febcb88c Mon Sep 17 00:00:00 2001
From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Date: Sun, 31 Mar 2024 16:08:20 +0200
Subject: [PATCH] Clarify the behavior of `Vector2/3.cross` and mention
parallel vectors
(cherry picked from commit 47a8033698b14c8a7bb25867198c1371382e3398)
---
doc/classes/Vector2.xml | 2 +-
doc/classes/Vector3.xml | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml
index e47542cd6..9a4f2bad9 100644
--- a/doc/classes/Vector2.xml
+++ b/doc/classes/Vector2.xml
@@ -94,7 +94,7 @@
Returns the 2D analog of the cross product for this vector and [code]with[/code].
- This is the signed area of the parallelogram formed by the two vectors. If the second vector is clockwise from the first vector, then the cross product is the positive area. If counter-clockwise, the cross product is the negative area.
+ This is the signed area of the parallelogram formed by the two vectors. If the second vector is clockwise from the first vector, then the cross product is the positive area. If counter-clockwise, the cross product is the negative area. If the two vectors are parallel this returns zero, making it useful for testing if two vectors are parallel.
[b]Note:[/b] Cross product is not defined in 2D mathematically. This method embeds the 2D vectors in the XY plane of 3D space and uses their cross product's Z component as the analog.
diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml
index 20fcf50cd..2d5133cf6 100644
--- a/doc/classes/Vector3.xml
+++ b/doc/classes/Vector3.xml
@@ -78,6 +78,7 @@
Returns the cross product of this vector and [code]b[/code].
+ This returns a vector perpendicular to both this and [param with], which would be the normal vector of the plane defined by the two vectors. As there are two such vectors, in opposite directions, this method returns the vector defined by a right-handed coordinate system. If the two vectors are parallel this returns an empty vector, making it useful for testing if two vectors are parallel.