mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-12 17:54:18 +02:00
refactor
This commit is contained in:
@@ -13,10 +13,9 @@ function _triangulate_snipable(shape_pts, u, v, w, n, indices, epsilon = 0.0001)
|
||||
let(
|
||||
a = shape_pts[indices[u]],
|
||||
b = shape_pts[indices[v]],
|
||||
c = shape_pts[indices[w]],
|
||||
determinant = cross([b.x - a.x, b.y - a.y], [c.x - a.x, c.y - a.y])
|
||||
c = shape_pts[indices[w]]
|
||||
)
|
||||
epsilon <= determinant && _triangulate_snipable_sub(shape_pts, n, u, v, w, a, b, c, indices);
|
||||
epsilon <= cross(b - a, c - a) && _triangulate_snipable_sub(shape_pts, n, u, v, w, a, b, c, indices);
|
||||
|
||||
function _triangulate_snipable_sub(shape_pts, n, u, v, w, a, b, c, indices, p = 0) =
|
||||
p == n || (
|
||||
|
@@ -15,13 +15,14 @@ function tri_incenter(shape_pts) =
|
||||
pc = shape_pts[2],
|
||||
a = norm(pb - pc),
|
||||
b = norm(pc - pa),
|
||||
c = norm(pa - pb)
|
||||
c = norm(pa - pb),
|
||||
abc = [a, b, c]
|
||||
)
|
||||
(len(pa) == 2 ? [
|
||||
(a * pa.x + b * pb.x + c * pc.x),
|
||||
(a * pa.y + b * pb.y + c * pc.y)
|
||||
abc * [pa.x, pb.x, pc.x],
|
||||
abc * [pa.y, pb.y, pc.y]
|
||||
] : [
|
||||
(a * pa.x + b * pb.x + c * pc.x),
|
||||
(a * pa.y + b * pb.y + c * pc.y),
|
||||
(a * pa.z + b * pb.z + c * pc.z)
|
||||
abc * [pa.x, pb.x, pc.x],
|
||||
abc * [pa.y, pb.y, pc.y],
|
||||
abc * [pa.z, pb.z, pc.z]
|
||||
]) / (a + b + c);
|
Reference in New Issue
Block a user