mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 22:28:16 +01:00
refactor
This commit is contained in:
parent
172f033ba4
commit
74edf0c591
@ -57,3 +57,13 @@ function _convex_hull_upper_chain(points, chain, m, t, i) =
|
||||
t,
|
||||
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) =
|
||||
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]];
|
||||
function convex_hull(points) = _convex_hull(points);
|
@ -1,5 +1,5 @@
|
||||
use <experimental/convex_hull.scad>;
|
||||
use <../__comm__/_convex_hull_impl.scad>;
|
||||
|
||||
module polygon_hull(points) {
|
||||
polygon(convex_hull(points);
|
||||
polygon(_convex_hull(points));
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user