From ff638350090d2984f79a18ae9f472f212af065c5 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sat, 8 Jun 2019 08:06:24 +0800 Subject: [PATCH] update doc --- docs/lib-in_polyline.md | 41 +++++++++++++++++++++++++++++++++++++++ docs/lib-in_polyline2d.md | 26 ------------------------- 2 files changed, 41 insertions(+), 26 deletions(-) create mode 100644 docs/lib-in_polyline.md delete mode 100644 docs/lib-in_polyline2d.md diff --git a/docs/lib-in_polyline.md b/docs/lib-in_polyline.md new file mode 100644 index 00000000..cb0d6869 --- /dev/null +++ b/docs/lib-in_polyline.md @@ -0,0 +1,41 @@ +# in_polyline + +Checks wether a point is on a line. + +**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 + + include ; + + pts = [ + [0, 0], + [10, 0], + [10, 10] + ]; + + echo(in_polyline(pts, [-2, -3])); // false + echo(in_polyline(pts, [5, 0])); // true + echo(in_polyline(pts, [10, 5])); // true + echo(in_polyline(pts, [10, 15])); // false + +---- + + include ; + + pts = [ + [10, 0, 10], + [20, 0, 10], + [20, 10, 10] + ]; + + echo(in_polyline(pts, [10, 0, 10])); // true + echo(in_polyline(pts, [15, 0, 10])); // true + echo(in_polyline(pts, [15, 1, 10])); // false + echo(in_polyline(pts, [20, 11, 10])); // false \ No newline at end of file diff --git a/docs/lib-in_polyline2d.md b/docs/lib-in_polyline2d.md deleted file mode 100644 index bcd3555b..00000000 --- a/docs/lib-in_polyline2d.md +++ /dev/null @@ -1,26 +0,0 @@ -# in_polyline2d - -Checks wether a point is on a line. - -**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 - - include ; - - pts = [ - [0, 0], - [10, 0], - [10, 10] - ]; - - echo(in_polyline2d(pts, [-2, -3])); // false - echo(in_polyline2d(pts, [5, 0])); // true - echo(in_polyline2d(pts, [10, 5])); // true - echo(in_polyline2d(pts, [10, 15])); // false \ No newline at end of file