aboutsummaryrefslogtreecommitdiff
path: root/src/math/polygon/triangulate.rs
diff options
context:
space:
mode:
authorArne Dußin2020-11-21 11:23:16 +0100
committerArne Dußin2020-11-21 11:23:16 +0100
commit58ca374fab6dd90c4d7415bdcc98add002274894 (patch)
tree94ec5f6c49f9c7e4e812550c82ad21110b02c2ce /src/math/polygon/triangulate.rs
parent32aec90d0fac637e165913f194422e5b3d96de36 (diff)
downloadgraf_karto-58ca374fab6dd90c4d7415bdcc98add002274894.tar.gz
graf_karto-58ca374fab6dd90c4d7415bdcc98add002274894.zip
Move polygon functions into own mod
The math module was starting to be mostly polygon files and functions, so those got their own subfolder to make the math module less of a mess.
Diffstat (limited to 'src/math/polygon/triangulate.rs')
-rw-r--r--src/math/polygon/triangulate.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/math/polygon/triangulate.rs b/src/math/polygon/triangulate.rs
new file mode 100644
index 0000000..4860518
--- /dev/null
+++ b/src/math/polygon/triangulate.rs
@@ -0,0 +1,13 @@
+//! Module for turning a polygon into a number of non-overlapping triangles.
+
+use super::Polygon;
+use crate::math::Triangle;
+use nalgebra::Scalar;
+
+/// Uses earclipping algorithm (see https://www.geometrictools.com/Documentation/TriangulationByEarClipping.pdf)
+/// to find an explanation of what exactly is happening.
+/// Currently only handles simple polygons, but once the polygon struct supports holes must be
+/// extended to also support those.
+pub fn triangulate<T: Scalar + Copy>(_polygon: &Polygon<T>) -> Vec<Triangle<T>> {
+ unimplemented!()
+}