From db0d381ceba734a0957208405315385976793006 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Tue, 12 Apr 2022 09:40:48 +0800 Subject: [PATCH] refactor: vector minus --- src/_impl/_in_shape_impl.scad | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/_impl/_in_shape_impl.scad b/src/_impl/_in_shape_impl.scad index a0076dc6..9e177a92 100644 --- a/src/_impl/_in_shape_impl.scad +++ b/src/_impl/_in_shape_impl.scad @@ -2,12 +2,9 @@ use <__comm__/__in_line.scad>; function _in_shape_in_line_equation(edge, pt) = let( - x1 = edge[0].x, - y1 = edge[0].y, - x2 = edge[1].x, - y2 = edge[1].y, - a = (y2 - y1) / (x2 - x1), - b = y1 - a * x1 + v = edge[1] - edge[0], + a = v.y / v.x, + b = edge[0].y - a * edge[0].x ) (pt.y == a * pt.x + b);