mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-17 20:11:50 +02:00
refactor: sort by cross
This commit is contained in:
@@ -2,8 +2,5 @@ use <../../util/sort.scad>;
|
|||||||
use <_convex_centroid.scad>;
|
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),
|
sort(points, by = function(p1, p2) cross(p2 - cpt, p1 - cpt));
|
||||||
pts_as = [for(p = points) [p, atan2(p.y - cpt.y, p.x - cpt.x)]]
|
|
||||||
)
|
|
||||||
[for(v = sort(pts_as, by = "idx", idx = 1)) v[0]];
|
|
Reference in New Issue
Block a user