|
| 1 | +#include <bits/stdc++.h> |
| 2 | +using namespace std; |
| 3 | + |
| 4 | +#define rep(i, a, b) for (int i = a; i < (b); ++i) |
| 5 | +#define trav(a, x) for (auto &a : x) |
| 6 | +#define all(x) x.begin(), x.end() |
| 7 | +#define sz(x) (int)(x).size() |
| 8 | +typedef long long ll; |
| 9 | +typedef pair<int, int> pii; |
| 10 | +typedef vector<int> vi; |
| 11 | + |
| 12 | +#include "../../content/geometry/CircleLine.h" |
| 13 | + |
| 14 | +typedef Point<double> P; |
| 15 | +int main() { |
| 16 | + cin.sync_with_stdio(0); |
| 17 | + cin.tie(0); |
| 18 | + cin.exceptions(cin.failbit); |
| 19 | + { |
| 20 | + auto res = circleLine(P(0, 0), 1, P(-1, -1), P(1, 1)); |
| 21 | + assert(res.size() == 2); |
| 22 | + assert((res[1]-P(sqrt(2)/2, sqrt(2)/2)).dist() < 1e-8); |
| 23 | + } |
| 24 | + { |
| 25 | + auto res = circleLine(P(0, 0), 1, P(-5, 1), P(5, 1)); |
| 26 | + assert(res.size() == 1); |
| 27 | + assert((res[0]-P(0,1)).dist() < 1e-8); |
| 28 | + } |
| 29 | + { |
| 30 | + auto res = circleLine(P(4, 4), 1, P(0, 0), P(5, 0)); |
| 31 | + assert(res.size() == 0); |
| 32 | + } |
| 33 | + cout<<"Tests passed!"<<endl; |
| 34 | +} |
0 commit comments