mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-06 14:56:47 +02:00
refactor
This commit is contained in:
@@ -26,10 +26,9 @@ function _tri_circumcircle(shape_pts) =
|
|||||||
x = (d1 * v0[1] - d0 * v1[1]) / det,
|
x = (d1 * v0[1] - d0 * v1[1]) / det,
|
||||||
y = (d0 * v1[0] - d1 * v0[0]) / det,
|
y = (d0 * v1[0] - d1 * v0[0]) / det,
|
||||||
center = [x, y],
|
center = [x, y],
|
||||||
v = p0 - center,
|
v = p0 - center
|
||||||
rr = v[0] ^ 2 + v[1] ^ 2
|
|
||||||
)
|
)
|
||||||
[center, rr];
|
[center, v * v];
|
||||||
|
|
||||||
function cc_center(cc) = cc[0];
|
function cc_center(cc) = cc[0];
|
||||||
function cc_rr(cc) = cc[1];
|
function cc_rr(cc) = cc[1];
|
||||||
|
@@ -4,7 +4,7 @@ use <_convex_centroid.scad>;
|
|||||||
function _convex_ct_clk_order(points) =
|
function _convex_ct_clk_order(points) =
|
||||||
let(
|
let(
|
||||||
cpt = _convex_centroid(points),
|
cpt = _convex_centroid(points),
|
||||||
pts_as = [for(p = points) [p, atan2(p[1] - cpt[1], p[0] - cpt[0])]],
|
pts_as = [for(p = points) [p, atan2(p.y - cpt.y, p.x - cpt.x)]],
|
||||||
sorted = sort(pts_as, by = "idx", idx = 1)
|
sorted = sort(pts_as, by = "idx", idx = 1)
|
||||||
)
|
)
|
||||||
[for(v = sorted) v[0]];
|
[for(v = sorted) v[0]];
|
Reference in New Issue
Block a user