2019-06-08 08:06:24 +08:00
|
|
|
# in_polyline
|
|
|
|
|
2021-04-09 11:36:08 +08:00
|
|
|
Checks whether a point is on a line.
|
2019-06-08 08:06:24 +08:00
|
|
|
|
|
|
|
**Since:** 1.3
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
- `line_pts` : The line points.
|
|
|
|
- `pt` : The point to be checked.
|
|
|
|
- `epsilon` : An upper bound on the relative error due to rounding in floating point arithmetic. Default to 0.0001.
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
2022-06-06 13:11:46 +08:00
|
|
|
use <in_polyline.scad>
|
2019-06-08 08:06:24 +08:00
|
|
|
|
|
|
|
pts = [
|
|
|
|
[0, 0],
|
|
|
|
[10, 0],
|
|
|
|
[10, 10]
|
|
|
|
];
|
|
|
|
|
2022-04-06 17:44:11 +08:00
|
|
|
assert(!in_polyline(pts, [-2, -3]));
|
|
|
|
assert(in_polyline(pts, [5, 0]));
|
|
|
|
assert(in_polyline(pts, [10, 5]));
|
|
|
|
assert(!in_polyline(pts, [10, 15]));
|
2019-06-08 08:06:24 +08:00
|
|
|
|
|
|
|
----
|
|
|
|
|
2022-06-06 13:11:46 +08:00
|
|
|
use <in_polyline.scad>
|
2019-06-08 08:06:24 +08:00
|
|
|
|
|
|
|
pts = [
|
|
|
|
[10, 0, 10],
|
|
|
|
[20, 0, 10],
|
|
|
|
[20, 10, 10]
|
|
|
|
];
|
|
|
|
|
2022-04-06 17:44:11 +08:00
|
|
|
assert(in_polyline(pts, [10, 0, 10]));
|
|
|
|
assert(in_polyline(pts, [15, 0, 10]));
|
|
|
|
assert(!in_polyline(pts, [15, 1, 10]));
|
|
|
|
assert(!in_polyline(pts, [20, 11, 10]));
|