mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-07-31 21:10:25 +02:00
Added points_are_collinear(). Renamed pointslist_is_coplanar() to points_are_coplanar()
This commit is contained in:
@@ -779,6 +779,21 @@ function polygon_line_intersection(poly, line, bounded=false, eps=EPSILON) =
|
|||||||
res[0];
|
res[0];
|
||||||
|
|
||||||
|
|
||||||
|
// Function: points_are_collinear()
|
||||||
|
// Usage:
|
||||||
|
// points_are_collinear(points);
|
||||||
|
// Description:
|
||||||
|
// Given a list of points, returns true if all points in the list are collinear.
|
||||||
|
// Arguments:
|
||||||
|
// points = The list of points to test.
|
||||||
|
// eps = How much variance is allowed in testing that each point is on the same line. Default: `EPSILON` (1e-9)
|
||||||
|
function points_are_collinear(points, eps=EPSILON) =
|
||||||
|
let(
|
||||||
|
a = furthest_point(points[0], points),
|
||||||
|
b = furthest_point(points[a], points)
|
||||||
|
) all([for (pt = points) collinear(points[a], points[b], pt, eps=eps)]);
|
||||||
|
|
||||||
|
|
||||||
// Function: coplanar()
|
// Function: coplanar()
|
||||||
// Usage:
|
// Usage:
|
||||||
// coplanar(plane, point);
|
// coplanar(plane, point);
|
||||||
@@ -794,15 +809,15 @@ function coplanar(plane, point, eps=EPSILON) =
|
|||||||
abs(distance_from_plane(plane, point)) <= eps;
|
abs(distance_from_plane(plane, point)) <= eps;
|
||||||
|
|
||||||
|
|
||||||
// Function: pointslist_is_coplanar()
|
// Function: points_are_coplanar()
|
||||||
// Usage:
|
// Usage:
|
||||||
// pointslist_is_coplanar(points);
|
// points_are_coplanar(points);
|
||||||
// Description:
|
// Description:
|
||||||
// Given a list of points, returns true if all points in the list are coplanar.
|
// Given a list of points, returns true if all points in the list are coplanar.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// points = The list of points to test.
|
// points = The list of points to test.
|
||||||
// eps = How much variance is allowed in testing that each point is on the same plane. Default: `EPSILON` (1e-9)
|
// eps = How much variance is allowed in testing that each point is on the same plane. Default: `EPSILON` (1e-9)
|
||||||
function pointslist_is_coplanar(points, eps=EPSILON) =
|
function points_are_coplanar(points, eps=EPSILON) =
|
||||||
let(
|
let(
|
||||||
plane = plane_from_pointslist(points, fast=true, eps=eps)
|
plane = plane_from_pointslist(points, fast=true, eps=eps)
|
||||||
) all([for (pt = points) coplanar(plane, pt, eps=eps)]);
|
) all([for (pt = points) coplanar(plane, pt, eps=eps)]);
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
BOSL_VERSION = [2,0,185];
|
BOSL_VERSION = [2,0,186];
|
||||||
|
|
||||||
|
|
||||||
// Section: BOSL Library Version Functions
|
// Section: BOSL Library Version Functions
|
||||||
|
Reference in New Issue
Block a user