This commit is contained in:
Adrian Mariano 2021-10-30 18:34:42 -04:00
parent 5153cb20da
commit f72d89fae7
2 changed files with 5 additions and 5 deletions

View file

@ -253,8 +253,8 @@ function line_intersection(line1, line2, bounded1, bounded2, bounded, eps=EPSILO
// pt = line_closest_point(line, pt, [bounded]);
// Topics: Geometry, Lines, Distance
// Description:
// Returns the point on the given 2D or 3D line, segment or ray that is closest to the given point `pt`.
// The inputs `line` and `pt` args should either both be 2D or both 3D. The parameter bounded indicates
// Returns the point on the given line, segment or ray that is closest to the given point `pt`.
// The inputs `line` and `pt` args should be of the same dimension. The parameter bounded indicates
// whether the points of `line` should be treated as endpoints.
// Arguments:
// line = A list of two points that are on the unbounded line.

View file

@ -523,8 +523,8 @@ function is_path_simple(path, closed, eps=EPSILON) =
// Finds the closest path segment, and point on that segment to the given point.
// Returns `[SEGNUM, POINT]`
// Arguments:
// path = The path to find the closest point on.
// pt = the point to find the closest point to.
// path = path of any dimension or a 1-region
// pt = the point to find the closest point to
// closed =
// Example(2D):
// path = circle(d=100,$fn=6);
@ -535,7 +535,7 @@ function is_path_simple(path, closed, eps=EPSILON) =
// color("red") translate(closest[1]) circle(d=3, $fn=12);
function path_closest_point(path, pt, closed=true) =
let(path = force_path(path))
assert(is_path(path,[2,3]), "Must give 2D or 3D path.")
assert(is_path(path), "Input must be a path")
assert(is_vector(pt, len(path[0])), "Input pt must be a compatible vector")
assert(is_bool(closed))
let(