diff options
| author | mzuenni <michi.zuendorf@gmail.com> | 2023-01-10 11:40:09 +0100 |
|---|---|---|
| committer | mzuenni <michi.zuendorf@gmail.com> | 2023-01-10 11:40:09 +0100 |
| commit | fd1f2b36e95c03625297b7b8cba3b1a04a0cc0ed (patch) | |
| tree | b143619750b90fbfa45a98be9ea56904d1a7129d /geometry | |
| parent | 8faa84ca282d51e9ce4fef535e68325adabcebad (diff) | |
change whitespaces
Diffstat (limited to 'geometry')
| -rw-r--r-- | geometry/antipodalPoints.cpp | 2 | ||||
| -rw-r--r-- | geometry/circle.cpp | 4 | ||||
| -rw-r--r-- | geometry/closestPair.cpp | 6 | ||||
| -rw-r--r-- | geometry/convexHull.cpp | 2 | ||||
| -rw-r--r-- | geometry/formulars3d.cpp | 4 | ||||
| -rw-r--r-- | geometry/linesAndSegments.cpp | 10 | ||||
| -rw-r--r-- | geometry/polygon.cpp | 2 | ||||
| -rw-r--r-- | geometry/segmentIntersection.cpp | 4 | ||||
| -rw-r--r-- | geometry/sortAround.cpp | 2 | ||||
| -rw-r--r-- | geometry/spheres.cpp | 8 | ||||
| -rw-r--r-- | geometry/triangle.cpp | 12 |
11 files changed, 28 insertions, 28 deletions
diff --git a/geometry/antipodalPoints.cpp b/geometry/antipodalPoints.cpp index c1921cc..707cf84 100644 --- a/geometry/antipodalPoints.cpp +++ b/geometry/antipodalPoints.cpp @@ -6,7 +6,7 @@ vector<pair<int, int>> antipodalPoints(vector<pt>& h) { while (true) { result.push_back({i, j}); if (cross(h[(i + 1) % n] - h[i], - h[(j + 1) % n] - h[j]) <= 0) break; + h[(j + 1) % n] - h[j]) <= 0) break; j = (j + 1) % n; }} return result; diff --git a/geometry/circle.cpp b/geometry/circle.cpp index f49ea27..fd52a0b 100644 --- a/geometry/circle.cpp +++ b/geometry/circle.cpp @@ -1,7 +1,7 @@ // berechnet die Schnittpunkte von zwei kreisen // (Kreise dürfen nicht gleich sein!) vector<pt> circleIntersection(pt c1, double r1, - pt c2, double r2) { + pt c2, double r2) { double d = abs(c1 - c2); if (d < abs(r1 - r2) || d > abs(r1 + r2)) return {}; double a = (r1 * r1 - r2 * r2 + d * d) / (2 * d); @@ -15,7 +15,7 @@ vector<pt> circleIntersection(pt c1, double r1, // berechnet die Schnittpunkte zwischen // einem Kreis(Kugel) und einer Grade 2d und 3d vector<pt> circleRayIntersection(pt center, double r, - pt orig, pt dir) { + pt orig, pt dir) { vector<pt> result; double a = dot(dir, dir); double b = 2 * dot(dir, orig - center); diff --git a/geometry/closestPair.cpp b/geometry/closestPair.cpp index 7462dc0..552eb0c 100644 --- a/geometry/closestPair.cpp +++ b/geometry/closestPair.cpp @@ -4,12 +4,12 @@ double squaredDist(pt a, pt b) { bool compY(pt a, pt b) { return (imag(a) == imag(b)) ? real(a) < real(b) - : imag(a) < imag(b); + : imag(a) < imag(b); } bool compX(pt a, pt b) { return (real(a) == real(b)) ? imag(a) < imag(b) - : real(a) < real(b); + : real(a) < real(b); } double shortestDist(vector<pt>& pts) { // pts.size() > 1 @@ -21,7 +21,7 @@ double shortestDist(vector<pt>& pts) { // pts.size() > 1 while (right != pts.end()) { if (left != right && - abs(real(*left - *right)) >= sqrtOpt) { + abs(real(*left - *right)) >= sqrtOpt) { status.erase(*left); left++; } else { diff --git a/geometry/convexHull.cpp b/geometry/convexHull.cpp index 9245acc..b1de170 100644 --- a/geometry/convexHull.cpp +++ b/geometry/convexHull.cpp @@ -1,7 +1,7 @@ vector<pt> convexHull(vector<pt> pts){ sort(all(pts), [](const pt& a, const pt& b){ return real(a) == real(b) ? imag(a) < imag(b) - : real(a) < real(b); + : real(a) < real(b); }); pts.erase(unique(all(pts)), pts.end()); int k = 0; diff --git a/geometry/formulars3d.cpp b/geometry/formulars3d.cpp index f527d57..65aba4a 100644 --- a/geometry/formulars3d.cpp +++ b/geometry/formulars3d.cpp @@ -6,8 +6,8 @@ double dot(pt3 a, pt3 b) {return a|b;} // Kreuzprodukt pt3 operator*(pt3 a, pt3 b) {return {a.y*b.z - a.z*b.y, - a.z*b.x - a.x*b.z, - a.x*b.y - a.y*b.x};} + a.z*b.x - a.x*b.z, + a.x*b.y - a.y*b.x};} pt3 cross(pt3 a, pt3 b) {return a*b;} // Länge von a diff --git a/geometry/linesAndSegments.cpp b/geometry/linesAndSegments.cpp index 9ed39c4..3a8ac02 100644 --- a/geometry/linesAndSegments.cpp +++ b/geometry/linesAndSegments.cpp @@ -2,11 +2,11 @@ bool lineSegmentIntersection(pt a, pt b, pt c, pt d) { if (orientation(a, b, c) == 0 && orientation(a, b, d) == 0) return pointOnLineSegment(a,b,c) || - pointOnLineSegment(a,b,d) || - pointOnLineSegment(c,d,a) || - pointOnLineSegment(c,d,b); + pointOnLineSegment(a,b,d) || + pointOnLineSegment(c,d,a) || + pointOnLineSegment(c,d,b); return orientation(a, b, c) * orientation(a, b, d) <= 0 && - orientation(c, d, a) * orientation(c, d, b) <= 0; + orientation(c, d, a) * orientation(c, d, b) <= 0; } // Berechnet die Schnittpunkte der Strecken p0-p1 und p2-p3. @@ -18,7 +18,7 @@ vector<pt> lineSegmentIntersection(pt p0, pt p1, pt p2, pt p3) { double c = cross(p1 - p0, p0 - p2); if (a < 0) {a = -a; b = -b; c = -c;} if (b < -EPS || a-b < -EPS || - c < -EPS || a-c < -EPS) return {}; + c < -EPS || a-c < -EPS) return {}; if (a > EPS) return {p0 + b/a*(p1 - p0)}; vector<pt> result; auto insertUnique = [&](pt p) { diff --git a/geometry/polygon.cpp b/geometry/polygon.cpp index 8acd591..ef70fb5 100644 --- a/geometry/polygon.cpp +++ b/geometry/polygon.cpp @@ -35,7 +35,7 @@ bool inside(pt p, const vector<pt>& hull) { void rotateMin(vector<pt>& hull) { auto mi = min_element(all(hull), [](const pt& a, const pt& b){ return real(a) == real(b) ? imag(a) < imag(b) - : real(a) < real(b); + : real(a) < real(b); }); rotate(hull.begin(), mi, hull.end()); } diff --git a/geometry/segmentIntersection.cpp b/geometry/segmentIntersection.cpp index c2961da..14b9586 100644 --- a/geometry/segmentIntersection.cpp +++ b/geometry/segmentIntersection.cpp @@ -4,7 +4,7 @@ struct seg { bool operator<(const seg& o) const { if (real(a) < real(o.a)) { int s = orientation(a, b, o.a); - return (s > 0 || (s == 0 && imag(a) < imag(o.a)));// + return (s > 0 || (s == 0 && imag(a) < imag(o.a))); } else if (real(a) > real(o.a)) { int s = orientation(o.a, o.b, a); return (s < 0 || (s == 0 && imag(a) < imag(o.a))); @@ -25,7 +25,7 @@ struct event { bool lessPT(const pt& a, const pt& b) { return real(a) != real(b) ? real(a) < real(b) - : imag(a) < imag(b); + : imag(a) < imag(b); } bool intersect(const seg& a, const seg& b) { diff --git a/geometry/sortAround.cpp b/geometry/sortAround.cpp index a95d224..c5e4ebd 100644 --- a/geometry/sortAround.cpp +++ b/geometry/sortAround.cpp @@ -1,5 +1,5 @@ bool left(pt p) {return real(p) < 0 ||
- (real(p) == 0 && imag(p) < 0);}
+ (real(p) == 0 && imag(p) < 0);}
void sortAround(pt p, vector<pt>& ps) {
sort(all(ps), [&](const pt& a, const pt& b){
diff --git a/geometry/spheres.cpp b/geometry/spheres.cpp index 0657ab8..01c54de 100644 --- a/geometry/spheres.cpp +++ b/geometry/spheres.cpp @@ -4,10 +4,10 @@ double gcDist(double pLat, double pLon, pLat *= PI / 180; pLon *= PI / 180; qLat *= PI / 180; qLon *= PI / 180; return radius * acos(cos(pLat) * cos(pLon) * - cos(qLat) * cos(qLon) + - cos(pLat) * sin(pLon) * - cos(qLat) * sin(qLon) + - sin(pLat) * sin(qLat)); + cos(qLat) * cos(qLon) + + cos(pLat) * sin(pLon) * + cos(qLat) * sin(qLon) + + sin(pLat) * sin(qLat)); } // Great Cirlce Distance mit kartesischen Koordinaten. diff --git a/geometry/triangle.cpp b/geometry/triangle.cpp index fedc873..4dbd532 100644 --- a/geometry/triangle.cpp +++ b/geometry/triangle.cpp @@ -15,11 +15,11 @@ double area(double a, double b, double c) { // Zentrum des Kreises durch alle Eckpunkte pt outCenter(pt a, pt b, pt c) { double d = 2.0 * (real(a) * imag(b-c) + - real(b) * imag(c-a) + - real(c) * imag(a-b)); + real(b) * imag(c-a) + + real(c) * imag(a-b)); return (a*conj(a)*conj(b-c) + - b*conj(b)*conj(c-a) + - c*conj(c)*conj(a-b)) / d; + b*conj(b)*conj(c-a) + + c*conj(c)*conj(a-b)) / d; } // Zentrum des größten Kreises im Dreiecke @@ -34,7 +34,7 @@ pt inCenter(pt a, pt b, pt c) { // zweite Zeile testet Ähnlichkeit mit verschiedener Orientierung bool similar (pt a1, pt b1, pt c1, pt a2, pt b2, pt c2) { return ((b2-a2) * (c1-a1) == (b1-a1) * (c2-a2) || - (b2-a2) * (conj(c1)-conj(a1)) == (conj(b1)-conj(a1)) - * (c2-a2) + (b2-a2) * (conj(c1)-conj(a1)) == (conj(b1)-conj(a1)) + * (c2-a2) ); } |
