1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-15 03:05:41 +02:00
This commit is contained in:
Justin Lin
2022-03-05 11:46:03 +08:00
parent ff8f754dcc
commit 0ca2eb4e93
3 changed files with 11 additions and 11 deletions

View File

@@ -87,14 +87,14 @@ function _convex_hull3(pts) =
leng = len(sorted),
v0 = 0,
v1 = _fst_v1(sorted, leng, v0 + 1),
_ = assert(v1 < leng, "common points"),
v2 = _fst_v2(sorted, leng, v1, v1 + 1),
__ = assert(v2 < leng, "collinear points"),
n = cross(sorted[v1] - sorted[v0], sorted[v2] - sorted[v0]),
v2 = assert(v1 < leng, "common points")
_fst_v2(sorted, leng, v1, v1 + 1),
n = assert(v2 < leng, "collinear points")
cross(sorted[v1] - sorted[v0], sorted[v2] - sorted[v0]),
v3_d = _fst_v3(sorted, leng, n, 0, v2 + 1),
v3 = v3_d[0],
___ = assert(v3 < leng, "coplanar points"),
d = v3_d[1],
d = assert(v3 < leng, "coplanar points")
v3_d[1],
fst_tetrahedron = d > 0 ? [
[v1, v0, v2],
[v0, v1, v3],

View File

@@ -43,10 +43,10 @@ function _bijection_offset_impl(pts, d, epsilon) =
let(
this_edge = offset_es[i],
next_edge = offset_es[i + 1],
p = __line_intersection2(this_edge, next_edge, epsilon),
// p == p to avoid [nan, nan], because [nan, nan] != [nan, nan],
_ = assert(p != [] && p == p, "bijection_offset failed. Parallel or conincident edges found")
p = __line_intersection2(this_edge, next_edge, epsilon)
)
// p == p to avoid [nan, nan], because [nan, nan] != [nan, nan]
assert(p != [] && p == p, "bijection_offset failed. Parallel or conincident edges found")
p
]
];

View File

@@ -3,7 +3,7 @@ function tri_is_ccw(shape_pts) =
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]),
_ = assert(area != 0, "points are collinear")
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;