mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-11 01:04:07 +02:00
refactor: vector can be compared
This commit is contained in:
@@ -23,9 +23,7 @@ function _convex_hull_upper_m(chain, p, m, t) =
|
|||||||
|
|
||||||
function _convex_hull_upper_chain(points, chain, m, t, i) =
|
function _convex_hull_upper_chain(points, chain, m, t, i) =
|
||||||
i < 0 ? chain :
|
i < 0 ? chain :
|
||||||
let(
|
let(current_m = _convex_hull_upper_m(chain, points[i], m, t))
|
||||||
current_m = _convex_hull_upper_m(chain, points[i], m, t)
|
|
||||||
)
|
|
||||||
_convex_hull_upper_chain(
|
_convex_hull_upper_chain(
|
||||||
points,
|
points,
|
||||||
[each slice(chain, 0, current_m), points[i]],
|
[each slice(chain, 0, current_m), points[i]],
|
||||||
@@ -36,7 +34,7 @@ function _convex_hull_upper_chain(points, chain, m, t, i) =
|
|||||||
|
|
||||||
function _convex_hull2(points) =
|
function _convex_hull2(points) =
|
||||||
let(
|
let(
|
||||||
sorted = sort(points, by = function(p1, p2) p1.x < p2.x || (p1.x == p2.x && p1.y < p2.y) ? -1 : 1),
|
sorted = sort(points, by = function(p1, p2) p1 < p2 ? -1 : 1),
|
||||||
leng = len(sorted),
|
leng = len(sorted),
|
||||||
lwr_ch = _convex_hull_lower_chain(sorted, leng, [], 0, 0),
|
lwr_ch = _convex_hull_lower_chain(sorted, leng, [], 0, 0),
|
||||||
leng_lwr_ch = len(lwr_ch),
|
leng_lwr_ch = len(lwr_ch),
|
||||||
|
Reference in New Issue
Block a user