summaryrefslogtreecommitdiff
path: root/geometry/formulars.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'geometry/formulars.cpp')
-rw-r--r--geometry/formulars.cpp15
1 files changed, 10 insertions, 5 deletions
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<int> verwenden.
-// Funktionen wie abs() geben dann int zurück.
+// Komplexe Zahlen als Punkte. Wenn immer möglich complex<ll>
+// verwenden. Funktionen wie abs() geben dann aber ll zurück.
using pt = complex<double>;
-// 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;
+}