From 65d957702f1e1d5fd202538fcf9ed6825eb45bb8 Mon Sep 17 00:00:00 2001 From: MZuenni Date: Thu, 26 Jun 2025 20:57:51 +0200 Subject: shorten code --- content/geometry/lines.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/geometry/lines.cpp b/content/geometry/lines.cpp index 36de1db..0267faa 100644 --- a/content/geometry/lines.cpp +++ b/content/geometry/lines.cpp @@ -8,9 +8,9 @@ line pointsToLine(pt p1, pt p2) { // vertikale Gerade: b = 1 oder b = 0 if (abs(real(p1 - p2)) < EPS) { l.a = 1; l.b = 0.0; l.c = -real(p1); } else { - l.a = -imag(p1 - p2) / real(p1 - p2); + l.a = imag(p2 - p1) / real(p1 - p2); l.b = 1.0; - l.c = -(l.a * real(p1)) - imag(p1); + l.c = -l.a * real(p1) - imag(p1); } return l; } -- cgit v1.2.3