From 679e3aae6249ff32fa6b37f7b146880b7817a0ae Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Thu, 26 Aug 2021 18:49:42 +0800 Subject: [PATCH] add tri_is_ccw --- src/experimental/tri_is_ccw.scad | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/experimental/tri_is_ccw.scad diff --git a/src/experimental/tri_is_ccw.scad b/src/experimental/tri_is_ccw.scad new file mode 100644 index 00000000..483cc132 --- /dev/null +++ b/src/experimental/tri_is_ccw.scad @@ -0,0 +1,6 @@ +function tri_is_ccw(p1, p2, p3) = + let( + area = (p2[0] - p1[0]) * (p3[1] - p1[1]) - (p3[0] - p1[0]) * (p2[1] - p1[1]), + _ = assert(area != 0, "points are collinear") + ) + area > 0; \ No newline at end of file