summaryrefslogtreecommitdiff
path: root/test/geometry/linesAndSegments.cpp
diff options
context:
space:
mode:
authorGloria Mundi <gloria@gloria-mundi.eu>2024-11-16 15:39:23 +0100
committerGloria Mundi <gloria@gloria-mundi.eu>2024-11-16 15:39:23 +0100
commit72bd993483453ed8ebc462f1a33385cd355d486f (patch)
treec5592ba1ed2fed79e26ba6158d097c9ceb43f061 /test/geometry/linesAndSegments.cpp
parent98567ec798aa8ca2cfbcb85c774dd470f30e30d4 (diff)
parent35d485bcf6a9ed0a9542628ce4aa94a3326d0884 (diff)
merge mzuenni changes
Diffstat (limited to 'test/geometry/linesAndSegments.cpp')
-rw-r--r--test/geometry/linesAndSegments.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/geometry/linesAndSegments.cpp b/test/geometry/linesAndSegments.cpp
index 2943a67..a2da3ba 100644
--- a/test/geometry/linesAndSegments.cpp
+++ b/test/geometry/linesAndSegments.cpp
@@ -30,7 +30,7 @@ void stress_lineIntersection(ll range) {
auto [c, d] = Random::line(range);
if (ccw(a, b, c) == 0 && ccw(a, b, d) == 0) continue;
- bool expected = ccw(0, a-b, c-d) == 0;
+ bool expected = ccw(0, a-b, c-d) != 0;
bool got = lineIntersection(a, b, c, d);
if (got != expected) cerr << "error" << FAIL;
@@ -49,7 +49,7 @@ void stress_lineIntersection2(ll range) {
auto got = lineIntersection2(a, b, c, d);
if (distToLine(a, b, got) > 1e-6) cerr << "error: 1" << FAIL;
- if (distToLine(a, b, got) > 1e-6) cerr << "error: 2" << FAIL;
+ if (distToLine(c, d, got) > 1e-6) cerr << "error: 2" << FAIL;
queries++;
}
cerr << "tested lineIntersection2: " << queries << endl;
@@ -172,7 +172,7 @@ void stress_segmentIntersection2(ll range) {
if (!got.empty() != tmp) cerr << "error: 1" << FAIL;
for (pt p : got) {
if (distToSegment(a, b, p) > 1e-6) cerr << "error: 2" << FAIL;
- if (distToSegment(a, b, p) > 1e-6) cerr << "error: 3" << FAIL;
+ if (distToSegment(c, d, p) > 1e-6) cerr << "error: 3" << FAIL;
}
if (tmp) {
double gotDist = abs(got.front() - got.back());
@@ -220,7 +220,7 @@ int main() {
stress_lineIntersection(100);
stress_lineIntersection(1'000'000'000);
stress_lineIntersection2(100);
- stress_lineIntersection2(1'000'000);
+ stress_lineIntersection2(1'000);//intersection can bet at N^3...
stress_distToLine(100);
stress_distToLine(1'000'000'000);
stress_projectToLine(100);