From 2008ff3e401e72652dcf8c876ae2aaabc61b6227 Mon Sep 17 00:00:00 2001 From: MerlotRain Date: Sat, 7 Dec 2024 08:35:04 +0800 Subject: [PATCH] build with clang --- .gitignore | 3 ++- apollonius.cpp | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index b498e69..c86c3aa 100644 --- a/.gitignore +++ b/.gitignore @@ -56,4 +56,5 @@ build .vscode Testing *.hx -*.js \ No newline at end of file +*.js +.DS_Store \ No newline at end of file diff --git a/apollonius.cpp b/apollonius.cpp index 4eb6112..4b4fff6 100644 --- a/apollonius.cpp +++ b/apollonius.cpp @@ -26,10 +26,10 @@ #include #include #include +#include +#include #include #include -#include -#include #ifndef M_PI #define M_PI 3.14159265358979323846 @@ -281,7 +281,7 @@ static std::vector getSolutionFromCCC(const APO_Circle& circle1, template static std::vector getIntersectionPoints(const T& t, const E& e, - bool limited = true); + bool limited); template <> std::vector getIntersectionPoints( const APO_Circle& t, const APO_Circle& e, bool limited); @@ -368,7 +368,8 @@ getIntersectionPoints(const APO_Circle& circle1, double r2 = circle2.radius; if (r1 < r2) { - return getIntersectionPoints(circle2, circle1); + return getIntersectionPoints(circle2, circle1, + true); } APO_Point c1 = circle1.center; @@ -780,7 +781,7 @@ getCircleTangentsThroughPoint(const APO_Circle& circle, const APO_Point& p) { APO_Circle circle2 = APO_Circle::createFrom2Points(p, circle.center); std::vector touching_points - = getIntersectionPoints(circle2, circle); + = getIntersectionPoints(circle2, circle, true); if (touching_points.size() == 1) { res.push_back(APO_Line(p, touching_points[0])); @@ -2059,12 +2060,12 @@ getSolutionFromCCC(const APO_Circle& c1, const APO_Circle& c2, // Get intersections of two concentric with the other circle and the locus: locus.radius = locus.radius - rDiff / 2; circle1.radius = circle1.radius + fabs(rDiff / 2); - std::vector ips = getIntersectionPoints(locus, circle1); + std::vector ips = getIntersectionPoints(locus, circle1, true); circle1.radius = circle1.radius - fabs(rDiff); // Avoid inversion through the center with negative radii: if (circle1.radius > 0) { - auto&& lips = getIntersectionPoints(locus, circle1); + auto&& lips = getIntersectionPoints(locus, circle1, true); ips.insert(ips.end(), lips.begin(), lips.end()); } @@ -2142,9 +2143,9 @@ getSolutionFromCCC(const APO_Circle& c1, const APO_Circle& c2, // special case: each circle intersects the other two, // at least one intersects through two points: - std::vector ips12 = getIntersectionPoints(circle1, circle2); - std::vector ips13 = getIntersectionPoints(circle1, circle3); - std::vector ips23 = getIntersectionPoints(circle2, circle3); + std::vector ips12 = getIntersectionPoints(circle1, circle2, true); + std::vector ips13 = getIntersectionPoints(circle1, circle3, true); + std::vector ips23 = getIntersectionPoints(circle2, circle3, true); size_t nIps12 = ips12.size(); size_t nIps13 = ips13.size();