1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-16 11:44:50 +02:00

add convex_ct_clk_order

This commit is contained in:
Justin Lin
2020-02-22 09:58:59 +08:00
parent 78fc088438
commit fb7eab6a31

View File

@@ -0,0 +1,10 @@
use <util/sort.scad>;
use <experimental/convex_center_p.scad>;
function convex_ct_clk_order(points) =
let(
cpt = convex_center_p(points),
pts_as = [for(p = points) [p, atan2(p[1] - cpt[1], p[0] - cpt[0])]],
sorted = sort(pts_as, by = "idx", idx = 1)
)
[for(v = sorted) v[0]];