summaryrefslogtreecommitdiff
path: root/content/geometry/hpi.cpp
diff options
context:
space:
mode:
authormzuenni <michi.zuendorf@gmail.com>2024-09-11 00:29:27 +0200
committermzuenni <michi.zuendorf@gmail.com>2024-09-11 00:29:27 +0200
commit0257f0b3c61f203f64c3817dfe19a08f6191517c (patch)
tree820d5c1ed1830bad5ee8f1498d9134ca4359393b /content/geometry/hpi.cpp
parentfacc5da35282ef30e5111cdc04942d118f4ae0c5 (diff)
moved stuff
Diffstat (limited to 'content/geometry/hpi.cpp')
-rw-r--r--content/geometry/hpi.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/content/geometry/hpi.cpp b/content/geometry/hpi.cpp
index c58a6e7..f3dc08d 100644
--- a/content/geometry/hpi.cpp
+++ b/content/geometry/hpi.cpp
@@ -27,22 +27,22 @@ struct hp {
if (ort == 0) return cross(from, to, a.from) < 0;
return cross(b.dir(), a.dir()) * ort > 0;
}
- ll y = cross(a.dir(), b.dir());
- ll z = cross(b.from - a.from, b.dir());
- ptl i = mul(y, a.from) + mul(z, a.dir()); //intersect a and b
- // check if i is outside/right of x
- return imag(conj(mul(sgn(y),dir()))*(i-mul(y,from))) < 0;
+ ll x = cross(a.dir(), b.dir());
+ ll y = cross(b.from - a.from, b.dir());
+ ptl i = mul(x, a.from) + mul(y, a.dir()); //intersect a and b
+ // check if i is outside/right of this
+ return imag(conj(mul(sgn(x),dir()))*(i-mul(x,from))) < 0;
}
};
constexpr ll lim = 2e9+7;
deque<hp> intersect(vector<hp> hps) {
- hps.push_back(hp(pt{lim+1,-1}));
- hps.push_back(hp(pt{lim+1,1}));
+ hps.push_back(hp(pt{lim + 1, -1}));
+ hps.push_back(hp(pt{lim + 1, 1}));
sort(all(hps));
- deque<hp> dq = {hp(pt{-lim, 1})};
+ deque<hp> dq = {hp(pt{-lim - 1, 1})};
for (auto x : hps) {
while (sz(dq) > 1 && x.check(dq.end()[-1], dq.end()[-2]))
dq.pop_back();