From 31a150da2bbbefb2417d85042cacdbd3c368ca10 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Tue, 25 Feb 2020 10:07:16 +0800 Subject: [PATCH] use cross to refactor --- src/_impl/_triangulate_impl.scad | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/_impl/_triangulate_impl.scad b/src/_impl/_triangulate_impl.scad index 1c5b2bb3..726e7df8 100644 --- a/src/_impl/_triangulate_impl.scad +++ b/src/_impl/_triangulate_impl.scad @@ -9,9 +9,6 @@ function _triangulate_in_triangle(p0, p1, p2, p) = ) (c0 > 0 && c1 > 0 && c2 > 0) || (c0 < 0 && c1 < 0 && c2 < 0); -function _triangulate_determinant_2x2(matrix) = - matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0]; - function _triangulate_snipable(shape_pts, u, v, w, n, indices, epsilon = 0.0001) = let( a = shape_pts[indices[u]], @@ -23,10 +20,7 @@ function _triangulate_snipable(shape_pts, u, v, w, n, indices, epsilon = 0.0001) by = b[1], cx = c[0], cy = c[1], - determinant = _triangulate_determinant_2x2([ - [bx - ax, by - ay], - [cx - ax, cy - ay] - ]) + determinant = cross([bx - ax, by - ay], [cx - ax, cy - ay]) ) epsilon > determinant ? false : _triangulate_snipable_sub(shape_pts, n, u, v, w, a, b, c, indices);