aboutsummaryrefslogtreecommitdiff
path: root/src/math/triangulate.rs
diff options
context:
space:
mode:
authorArne Dußin2020-11-21 00:36:32 +0100
committerArne Dußin2020-11-21 00:36:32 +0100
commitd7d90e8b3615db38d1af238ac9c8193c283ca156 (patch)
tree6f500e94448748d21557b1f6cb3127a7ee9d3db7 /src/math/triangulate.rs
parentd6a0708b995b6c0e12ed8890c678c180f859de51 (diff)
downloadgraf_karto-d7d90e8b3615db38d1af238ac9c8193c283ca156.tar.gz
graf_karto-d7d90e8b3615db38d1af238ac9c8193c283ca156.zip
Add triangle struct and triangulation template
Diffstat (limited to 'src/math/triangulate.rs')
-rw-r--r--src/math/triangulate.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/math/triangulate.rs b/src/math/triangulate.rs
new file mode 100644
index 0000000..8ef92f1
--- /dev/null
+++ b/src/math/triangulate.rs
@@ -0,0 +1,12 @@
+//! Module for turning a polygon into a number of non-overlapping triangles.
+
+use super::{Polygon, 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!()
+}