diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-05-21 11:22:53 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-05-21 11:22:53 +0200 |
commit | dcc7cb01a7a1348fc70147b06789ade43fb7e462 (patch) | |
tree | 22fc9ef4cdc0fbd9f0220379d78ec3978891a3e4 | |
parent | 149e3b85aa5ffa6820091e6532ac79a219bda3c9 (diff) | |
parent | 331ecf3ca86c3fca5e8e289cef47829e111d93ee (diff) | |
download | redot-engine-dcc7cb01a7a1348fc70147b06789ade43fb7e462.tar.gz |
Merge pull request #92154 from lawnjelly/is_polygon_clockwise_doc
Clarify `is_polygon_clockwise()` coordinate system
-rw-r--r-- | core/math/geometry_2d.h | 2 | ||||
-rw-r--r-- | doc/classes/Geometry2D.xml | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/core/math/geometry_2d.h b/core/math/geometry_2d.h index 1502b2807c..83ebdc5a84 100644 --- a/core/math/geometry_2d.h +++ b/core/math/geometry_2d.h @@ -350,6 +350,8 @@ public: return triangles; } + // Assumes cartesian coordinate system with +x to the right, +y up. + // If using screen coordinates (+x to the right, +y down) the result will need to be flipped. static bool is_polygon_clockwise(const Vector<Vector2> &p_polygon) { int c = p_polygon.size(); if (c < 3) { diff --git a/doc/classes/Geometry2D.xml b/doc/classes/Geometry2D.xml index dfcf299fe6..f21696d02c 100644 --- a/doc/classes/Geometry2D.xml +++ b/doc/classes/Geometry2D.xml @@ -116,6 +116,7 @@ <param index="0" name="polygon" type="PackedVector2Array" /> <description> Returns [code]true[/code] if [param polygon]'s vertices are ordered in clockwise order, otherwise returns [code]false[/code]. + [b]Note:[/b] Assumes a Cartesian coordinate system where [code]+x[/code] is right and [code]+y[/code] is up. If using screen coordinates ([code]+y[/code] is down), the result will need to be flipped (i.e. a [code]true[/code] result will indicate counter-clockwise). </description> </method> <method name="line_intersects_line"> |