diff --git a/geometry.scad b/geometry.scad index dd35ddc..168a91d 100644 --- a/geometry.scad +++ b/geometry.scad @@ -1359,21 +1359,40 @@ function first_noncollinear(i1, i2, points) = // find_noncollinear_points(points); // Description: // Finds the indices of three good non-collinear points from the points list `points`. -function find_noncollinear_points(points) = +function find_noncollinear_points(points,error=true,eps=EPSILON) = + let( + pa = points[0], + b = furthest_point(pa, points), + n = unit(points[b]-pa), + relpoints = [for(pt=points) pt-pa], + proj = relpoints * n, + distlist = [for(i=[0:len(points)-1]) norm(relpoints[i]-proj[i]*n)] + ) + max(distlist)