mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-11 17:24:20 +02:00
use cross to refactor
This commit is contained in:
@@ -9,9 +9,6 @@ function _triangulate_in_triangle(p0, p1, p2, p) =
|
|||||||
)
|
)
|
||||||
(c0 > 0 && c1 > 0 && c2 > 0) || (c0 < 0 && c1 < 0 && c2 < 0);
|
(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) =
|
function _triangulate_snipable(shape_pts, u, v, w, n, indices, epsilon = 0.0001) =
|
||||||
let(
|
let(
|
||||||
a = shape_pts[indices[u]],
|
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],
|
by = b[1],
|
||||||
cx = c[0],
|
cx = c[0],
|
||||||
cy = c[1],
|
cy = c[1],
|
||||||
determinant = _triangulate_determinant_2x2([
|
determinant = cross([bx - ax, by - ay], [cx - ax, cy - ay])
|
||||||
[bx - ax, by - ay],
|
|
||||||
[cx - ax, cy - ay]
|
|
||||||
])
|
|
||||||
)
|
)
|
||||||
epsilon > determinant ?
|
epsilon > determinant ?
|
||||||
false : _triangulate_snipable_sub(shape_pts, n, u, v, w, a, b, c, indices);
|
false : _triangulate_snipable_sub(shape_pts, n, u, v, w, a, b, c, indices);
|
||||||
|
Reference in New Issue
Block a user