mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-11 17:24:20 +02:00
refactor
This commit is contained in:
@@ -57,3 +57,13 @@ function _convex_hull_upper_chain(points, chain, m, t, i) =
|
|||||||
t,
|
t,
|
||||||
i - 1
|
i - 1
|
||||||
);
|
);
|
||||||
|
|
||||||
|
function _convex_hull(points) =
|
||||||
|
let(
|
||||||
|
sorted = _convex_hull_sort_by_xy(points),
|
||||||
|
leng = len(sorted),
|
||||||
|
lwr_ch = _convex_hull_lower_chain(sorted, leng, [], 0, 0),
|
||||||
|
leng_lwr_ch = len(lwr_ch),
|
||||||
|
chain = _convex_hull_upper_chain(sorted, lwr_ch, leng_lwr_ch, leng_lwr_ch + 1, leng - 2)
|
||||||
|
)
|
||||||
|
[for(i = [0:len(chain) - 2]) chain[i]];
|
@@ -1,11 +1,3 @@
|
|||||||
use <experimental/_impl/_convex_hull_impl.scad>;
|
use <../__comm__/_convex_hull_impl.scad>;
|
||||||
|
|
||||||
function convex_hull(points) =
|
function convex_hull(points) = _convex_hull(points);
|
||||||
let(
|
|
||||||
sorted = _convex_hull_sort_by_xy(points),
|
|
||||||
leng = len(sorted),
|
|
||||||
lwr_ch = _convex_hull_lower_chain(sorted, leng, [], 0, 0),
|
|
||||||
leng_lwr_ch = len(lwr_ch),
|
|
||||||
chain = _convex_hull_upper_chain(sorted, lwr_ch, leng_lwr_ch, leng_lwr_ch + 1, leng - 2)
|
|
||||||
)
|
|
||||||
[for(i = [0:len(chain) - 2]) chain[i]];
|
|
@@ -1,5 +1,5 @@
|
|||||||
use <experimental/convex_hull.scad>;
|
use <../__comm__/_convex_hull_impl.scad>;
|
||||||
|
|
||||||
module polygon_hull(points) {
|
module polygon_hull(points) {
|
||||||
polygon(convex_hull(points);
|
polygon(_convex_hull(points));
|
||||||
}
|
}
|
Reference in New Issue
Block a user