mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-06 04:09:47 +00:00
_find_first_noncollinear() -> first_noncollinear()
This commit is contained in:
parent
eb313d30f5
commit
be6575b5fd
1 changed files with 2 additions and 7 deletions
|
@ -88,7 +88,7 @@ module hull_points(points, fast=false) {
|
||||||
function hull2d_path(points) =
|
function hull2d_path(points) =
|
||||||
(len(points) < 3)? [] : let(
|
(len(points) < 3)? [] : let(
|
||||||
a=0, b=1,
|
a=0, b=1,
|
||||||
c = _find_first_noncollinear([a,b], points, 2)
|
c = first_noncollinear(a, b, points, 2)
|
||||||
) (c == len(points))? _hull2d_collinear(points) : let(
|
) (c == len(points))? _hull2d_collinear(points) : let(
|
||||||
remaining = [ for (i = [2:1:len(points)-1]) if (i != c) i ],
|
remaining = [ for (i = [2:1:len(points)-1]) if (i != c) i ],
|
||||||
ccw = triangle_area(points[a], points[b], points[c]) > 0,
|
ccw = triangle_area(points[a], points[b], points[c]) > 0,
|
||||||
|
@ -121,11 +121,6 @@ function _hull2d_collinear(points) =
|
||||||
) [min_i, max_i];
|
) [min_i, max_i];
|
||||||
|
|
||||||
|
|
||||||
function _find_first_noncollinear(line, points, i) =
|
|
||||||
(i>=len(points) || !collinear_indexed(points, line[0], line[1], i))? i :
|
|
||||||
_find_first_noncollinear(line, points, i+1);
|
|
||||||
|
|
||||||
|
|
||||||
function _find_conflicting_segments(points, polygon, point) = [
|
function _find_conflicting_segments(points, polygon, point) = [
|
||||||
for (i = [0:1:len(polygon)-1]) let(
|
for (i = [0:1:len(polygon)-1]) let(
|
||||||
j = (i+1) % len(polygon),
|
j = (i+1) % len(polygon),
|
||||||
|
@ -168,7 +163,7 @@ function hull3d_faces(points) =
|
||||||
// start with a single non-collinear triangle
|
// start with a single non-collinear triangle
|
||||||
a = 0,
|
a = 0,
|
||||||
b = 1,
|
b = 1,
|
||||||
c = _find_first_noncollinear([a,b], points, 2)
|
c = first_noncollinear(a, b, points, 2)
|
||||||
) (c == len(points))? _hull2d_collinear(points) : let(
|
) (c == len(points))? _hull2d_collinear(points) : let(
|
||||||
plane = plane3pt_indexed(points, a, b, c),
|
plane = plane3pt_indexed(points, a, b, c),
|
||||||
d = _find_first_noncoplanar(plane, points, 3)
|
d = _find_first_noncoplanar(plane, points, 3)
|
||||||
|
|
Loading…
Reference in a new issue