From f23679138f76033d2e0e60373344573de59b9476 Mon Sep 17 00:00:00 2001 From: mzuenni Date: Tue, 31 Jan 2023 16:09:55 +0100 Subject: updated formulars --- geometry/formulars.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'geometry/formulars.cpp') diff --git a/geometry/formulars.cpp b/geometry/formulars.cpp index 43affbb..855ef1e 100644 --- a/geometry/formulars.cpp +++ b/geometry/formulars.cpp @@ -1,10 +1,8 @@ -// Komplexe Zahlen als Darstellung für Punkte. -// Wenn immer möglich complex verwenden. -// Funktionen wie abs() geben dann int zurück. +// Komplexe Zahlen als Punkte. Wenn immer möglich complex +// verwenden. Funktionen wie abs() geben dann aber ll zurück. using pt = complex; -// PIL < PI < PIU -constexpr double PIU = acos(-1.0l); +constexpr double PIU = acos(-1.0l); // PIL < PI < PIU constexpr double PIL = PIU-2e-19l; // Winkel zwischen Punkt und x-Achse in [-PI, PI]. @@ -35,3 +33,10 @@ int orientation(pt a, pt b, pt c) { bool isCoplanar(pt a, pt b, pt c, pt d) { return abs((b - a) * (c - a) * (d - a)) < EPS; } + +// identifiziert winkel zwischen Vektoren u und v +pt uniqueAngle(pt u, pt v) { + pt tmp = v * conj(u); + ll g = abs(gcd(real(tmp), imag(tmp))); + return tmp / g; +} -- cgit v1.2.3