summaryrefslogtreecommitdiff
path: root/content/geometry/linesAndSegments.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'content/geometry/linesAndSegments.cpp')
-rw-r--r--content/geometry/linesAndSegments.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/content/geometry/linesAndSegments.cpp b/content/geometry/linesAndSegments.cpp
index ddab554..985ee24 100644
--- a/content/geometry/linesAndSegments.cpp
+++ b/content/geometry/linesAndSegments.cpp
@@ -28,9 +28,7 @@ pt projectToLine(pt a, pt b, pt p) {
// sortiert alle Punkte pts auf einer Linie entsprechend dir
void sortLine(pt dir, vector<pt>& pts) { // (2d und 3d)
- sort(all(pts), [&](pt a, pt b){
- return dot(dir, a) < dot(dir, b);
- });
+ ranges::sort(pts, {}, [&](pt x) { return dot(dir, x); });
}
// Liegt p auf der Strecke a-b? (nutze < für inberhalb)
@@ -66,7 +64,7 @@ vector<pt> segmentIntersection2(pt a, pt b, pt c, pt d) {
double x = cross(b - a, d - c);
double y = cross(c - a, d - c);
double z = cross(b - a, a - c);
- if (x < 0) {x = -x; y = -y; z = -z;}
+ if (x < 0) { x = -x; y = -y; z = -z; }
if (y < -EPS || y-x > EPS || z < -EPS || z-x > EPS) return {};
if (x > EPS) return {a + y/x*(b - a)};
vector<pt> result;