1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-05 14:27:45 +02:00

det == 0 is never error

This commit is contained in:
Justin Lin
2022-04-04 21:27:11 +08:00
parent 38ce75b708
commit 7c40e28e64

View File

@@ -18,16 +18,13 @@ function _tri_circumcircle(shape_pts) =
d0 = (p1 + p0) / 2 * v0,
v1 = p2 - p1,
d1 = (p2 + p1) / 2 * v1,
det = -cross(v0 , v1)
det = -cross(v0 , v1),
x = (d1 * v0.y - d0 * v1.y) / det,
y = (d0 * v1.x - d1 * v0.x) / det,
center = [x, y],
v = p0 - center
)
det == 0 ? undef :
let(
x = (d1 * v0.y - d0 * v1.y) / det,
y = (d0 * v1.x - d1 * v0.x) / det,
center = [x, y],
v = p0 - center
)
[center, v * v];
[center, v * v];
function cc_center(cc) = cc[0];
function cc_rr(cc) = cc[1];