diff --git a/html/images/space.svg b/html/images/space.svg
index a5b7ab4..7e5dd5c 100644
--- a/html/images/space.svg
+++ b/html/images/space.svg
@@ -529,10 +529,13 @@
return edge || actualCorner;
}
- function lineIntxnPt({ x1, y1, x2, y2 }, {x1: x3, y1: y3, x2: x4, y2: y4 }) {
+ function lineIntxnPt({ x1, y1, x2, y2 }, { x1: x3, y1: y3, x2: x4, y2: y4 }) {
// https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line
- const x = ((x1*y2-y1*x2)*(x3-x4)-(x1-x2)*(x3*y4-y3*x4))/((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4));
- const y = ((x1*y2-y1*x2)*(y3-y4)-(y1-y2)*(x3*y4-y3*x4))/((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4));
+ const denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
+ const l1Det = x1 * y2 - y1 * x2;
+ const l2Det = x3 * y4 - y3 * x4;
+ const x = (l1Det * (x3 - x4) - (x1 - x2) * l2Det) / denominator;
+ const y = (l1Det * (y3 - y4) - (y1 - y2) * l2Det) / denominator;
return { x: x, y: y };
}