From 40c440f2c69b5513e358e331213163df4ddc4f15 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Mon, 18 May 2020 17:32:52 +0800 Subject: [PATCH] add doc --- docs/lib2x-lines_intersection2.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 docs/lib2x-lines_intersection2.md diff --git a/docs/lib2x-lines_intersection2.md b/docs/lib2x-lines_intersection2.md new file mode 100644 index 00000000..a325d4f5 --- /dev/null +++ b/docs/lib2x-lines_intersection2.md @@ -0,0 +1,23 @@ +# lines_intersection2 + +Find the intersection of two line segments. Return `[]` if lines don't intersect. + +**Since:** 2.4 + +## Parameters + +- `line1` : Two points of 2D line1. +- `line2` : Two points of 2D line2. +- `ext` : Default to `false`, which doesn't extend a line to an intersection with another line. +- `epsilon` : An upper bound on the relative error due to rounding in floating point arithmetic. Default to 0.0001. + +## Examples + + use ; + + line1 = [[0, 0], [0, 10]]; + line2 = [[5, 0], [-5, 5]]; + line3 = [[5, 0], [2.5, 5]]; + + assert(lines_intersection2(line1, line2) == [0, 2.5]); + assert(lines_intersection2(line1, line3, ext = true) == [0, 10]);