mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-21 14:04:53 +02:00
refacto: swap when leng == 2
This commit is contained in:
@@ -6,6 +6,7 @@ function _cmp(a, b) =
|
|||||||
function _convex_hull_sort_by_xyz(pts) =
|
function _convex_hull_sort_by_xyz(pts) =
|
||||||
let(leng = len(pts))
|
let(leng = len(pts))
|
||||||
leng <= 1 ? pts :
|
leng <= 1 ? pts :
|
||||||
|
leng == 2 ? (_cmp(pts[1], pts[0]) ? pts : [pts[1], pts[0]]) :
|
||||||
let(
|
let(
|
||||||
pivot = pts[0],
|
pivot = pts[0],
|
||||||
before = [for(j = 1; j < leng; j = j + 1) if(_cmp(pts[j], pivot)) pts[j]],
|
before = [for(j = 1; j < leng; j = j + 1) if(_cmp(pts[j], pivot)) pts[j]],
|
||||||
|
Reference in New Issue
Block a user