From ad760d1f4a26442938fbc19209767796cea83c9d Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Mon, 11 Apr 2022 11:31:14 +0800 Subject: [PATCH] refactor: use cross --- src/experimental/tri_is_ccw.scad | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/experimental/tri_is_ccw.scad b/src/experimental/tri_is_ccw.scad index d9e17564..d02edbae 100644 --- a/src/experimental/tri_is_ccw.scad +++ b/src/experimental/tri_is_ccw.scad @@ -1,9 +1,4 @@ function tri_is_ccw(shape_pts) = - let( - p1 = shape_pts[0], - p2 = shape_pts[1], - p3 = shape_pts[2], - area = (p2[0] - p1[0]) * (p3[1] - p1[1]) - (p3[0] - p1[0]) * (p2[1] - p1[1]) - ) + let(area = cross(shape_pts[1] - shape_pts[0], shape_pts[2] - shape_pts[0])) assert(area != 0, "points are collinear") area > 0; \ No newline at end of file