1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-12 09:44:16 +02:00
This commit is contained in:
Justin Lin
2020-05-19 14:45:06 +08:00
parent f364dcc840
commit f89e87e146
2 changed files with 5 additions and 5 deletions

View File

@@ -13,11 +13,11 @@ Find the intersection of two line segments. Return `[]` if lines don't intersect
## Examples ## Examples
use <lines_intersection2.scad>; use <lines_intersection.scad>;
line1 = [[0, 0], [0, 10]]; line1 = [[0, 0], [0, 10]];
line2 = [[5, 0], [-5, 5]]; line2 = [[5, 0], [-5, 5]];
line3 = [[5, 0], [2.5, 5]]; line3 = [[5, 0], [2.5, 5]];
assert(lines_intersection2(line1, line2) == [0, 2.5]); assert(lines_intersection(line1, line2) == [0, 2.5]);
assert(lines_intersection2(line1, line3, ext = true) == [0, 10]); assert(lines_intersection(line1, line3, ext = true) == [0, 10]);

View File

@@ -4,14 +4,14 @@
* @copyright Justin Lin, 2020 * @copyright Justin Lin, 2020
* @license https://opensource.org/licenses/lgpl-3.0.html * @license https://opensource.org/licenses/lgpl-3.0.html
* *
* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-lines_intersection2.html * @see https://openhome.cc/eGossip/OpenSCAD/lib2x-lines_intersection.html
* *
**/ **/
use <__comm__/__line_intersection.scad>; use <__comm__/__line_intersection.scad>;
use <__comm__/__in_line.scad>; use <__comm__/__in_line.scad>;
function lines_intersection2(line1, line2, ext = false, epsilon = 0.0001) = function lines_intersection(line1, line2, ext = false, epsilon = 0.0001) =
let( let(
pt = __line_intersection(line1, line2, epsilon) pt = __line_intersection(line1, line2, epsilon)
) )