From 9084e520f72cf6770c20274c47870ce2bcbaa0e0 Mon Sep 17 00:00:00 2001 From: Wai-Shing Luk Date: Thu, 1 Feb 2024 09:47:54 +0000 Subject: [PATCH] apply fix-format --- include/projgeom/ck_concepts.hpp | 25 +++---- include/projgeom/ck_plane.hpp | 10 +-- include/projgeom/common_concepts.h | 60 ++++++--------- include/projgeom/ell_object.hpp | 8 +- include/projgeom/euclid_plane.hpp | 6 +- include/projgeom/euclid_plane_measure.hpp | 17 ++--- include/projgeom/persp_plane.hpp | 2 +- include/projgeom/pg_common.hpp | 4 +- include/projgeom/pg_concepts.hpp | 39 +++++----- include/projgeom/pg_plane.hpp | 30 ++++---- include/projgeom/pg_point.hpp | 4 +- include/projgeom/proj_plane.hpp | 12 +-- include/projgeom/proj_plane_concepts.h | 90 ++++++++++++----------- include/projgeom/proj_plane_measure.hpp | 5 +- 14 files changed, 146 insertions(+), 166 deletions(-) diff --git a/include/projgeom/ck_concepts.hpp b/include/projgeom/ck_concepts.hpp index a9512a6..582ec4e 100644 --- a/include/projgeom/ck_concepts.hpp +++ b/include/projgeom/ck_concepts.hpp @@ -11,12 +11,11 @@ namespace fun { * @tparam Point Point * @tparam Line Line */ - template concept CayleyKleinPlanePrimitive - = // + template + concept CayleyKleinPlanePrimitive = // ProjectivePlanePrimitive // - &&requires(const Point &pt_p, const Line &ln_l) { - { pt_p.perp() } - ->concepts::convertible_to; // pole or polar + && requires(const Point &pt_p, const Line &ln_l) { + { pt_p.perp() } -> concepts::convertible_to; // pole or polar }; /** @@ -25,8 +24,9 @@ namespace fun { * @tparam Point Point * @tparam Line Line */ - template concept CayleyKleinPlanePrimitiveDual - = CayleyKleinPlanePrimitive &&CayleyKleinPlanePrimitive; + template + concept CayleyKleinPlanePrimitiveDual + = CayleyKleinPlanePrimitive && CayleyKleinPlanePrimitive; /** * @brief Cayley-Klein plane Concept @@ -34,12 +34,11 @@ namespace fun { * @tparam Point Point * @tparam Line Line */ - template concept CayleyKleinPlane - = // + template + concept CayleyKleinPlane = // ProjectivePlane // - &&requires(const Point &pt_p, const Line &ln_l) { - { pt_p.perp() } - ->concepts::convertible_to; // pole or polar + && requires(const Point &pt_p, const Line &ln_l) { + { pt_p.perp() } -> concepts::convertible_to; // pole or polar }; /** @@ -50,6 +49,6 @@ namespace fun { */ template concept CayleyKleinPlaneDual - = CayleyKleinPlane &&CayleyKleinPlane; + = CayleyKleinPlane && CayleyKleinPlane; } // namespace fun diff --git a/include/projgeom/ck_plane.hpp b/include/projgeom/ck_plane.hpp index 3330014..c2a91cf 100644 --- a/include/projgeom/ck_plane.hpp +++ b/include/projgeom/ck_plane.hpp @@ -17,7 +17,7 @@ namespace fun { #if __cpp_concepts >= 201907L requires CayleyKleinPlanePrimitiveDual #endif - constexpr auto is_perpendicular(const Line &m1, const Line &m2) -> bool { + constexpr auto is_perpendicular(const Line &m1, const Line &m2) -> bool { return m1.perp().incident(m2); } @@ -31,7 +31,7 @@ namespace fun { #if __cpp_concepts >= 201907L requires CayleyKleinPlanePrimitiveDual #endif - constexpr auto altitude(const Point &pt_p, const Line &ln_m) -> Line { + constexpr auto altitude(const Point &pt_p, const Line &ln_m) -> Line { return ln_m.perp().meet(pt_p); } @@ -45,7 +45,7 @@ namespace fun { #if __cpp_concepts >= 201907L requires CayleyKleinPlanePrimitiveDual #endif - constexpr auto orthocenter(const std::array &triangle) -> Point { + constexpr auto orthocenter(const std::array &triangle) -> Point { const auto &[a1, a2, a3] = triangle; assert(!coincident(a1, a2, a3)); const auto t1 = altitude(a1, a2.meet(a3)); @@ -63,7 +63,7 @@ namespace fun { #if __cpp_concepts >= 201907L requires CayleyKleinPlanePrimitiveDual #endif - constexpr auto tri_altitude(const std::array &triangle) -> std::array { + constexpr auto tri_altitude(const std::array &triangle) -> std::array { const auto [l1, l2, l3] = tri_dual(triangle); const auto &[a1, a2, a3] = triangle; assert(!coincident(a1, a2, a3)); @@ -77,7 +77,7 @@ namespace fun { #if __cpp_concepts >= 201907L requires CayleyKleinPlaneDual #endif - constexpr auto reflect(const Line &mirror, const Point &pt_p) -> Point { + constexpr auto reflect(const Line &mirror, const Point &pt_p) -> Point { return involution(mirror.perp(), mirror, pt_p); } diff --git a/include/projgeom/common_concepts.h b/include/projgeom/common_concepts.h index afbb064..9c9345a 100644 --- a/include/projgeom/common_concepts.h +++ b/include/projgeom/common_concepts.h @@ -20,48 +20,36 @@ namespace fun { * * @tparam T */ - template concept Sequence = requires(T t, Element_type x) { - { t.size() } - ->STD_ALT::convertible_to; - { t.empty() } - ->STD_ALT::convertible_to; - { t.back() } - ->STD_ALT::same_as>; + template + concept Sequence = requires(T t, Element_type x) { + { t.size() } -> STD_ALT::convertible_to; + { t.empty() } -> STD_ALT::convertible_to; + { t.back() } -> STD_ALT::same_as>; {t.push_back(x)}; }; - template concept Ring = STD_ALT::equality_comparable &&requires(K a, K pt_b) { - { a + pt_b } - ->STD_ALT::convertible_to; - { a - pt_b } - ->STD_ALT::convertible_to; - { a *pt_b } - ->STD_ALT::convertible_to; - { a += pt_b } - ->STD_ALT::same_as; - { a -= pt_b } - ->STD_ALT::same_as; - { a *= pt_b } - ->STD_ALT::same_as; - { -a } - ->STD_ALT::convertible_to; - { K(a) } - ->STD_ALT::convertible_to; - { K(0) } - ->STD_ALT::convertible_to; + template + concept Ring = STD_ALT::equality_comparable && requires(K a, K pt_b) { + { a + pt_b } -> STD_ALT::convertible_to; + { a - pt_b } -> STD_ALT::convertible_to; + { a *pt_b } -> STD_ALT::convertible_to; + { a += pt_b } -> STD_ALT::same_as; + { a -= pt_b } -> STD_ALT::same_as; + { a *= pt_b } -> STD_ALT::same_as; + { -a } -> STD_ALT::convertible_to; + { K(a) } -> STD_ALT::convertible_to; + { K(0) } -> STD_ALT::convertible_to; }; - template concept OrderedRing = Ring &&STD_ALT::totally_ordered; + template + concept OrderedRing = Ring && STD_ALT::totally_ordered; - template concept Integral = OrderedRing &&requires(Z a, Z pt_b) { - { a % pt_b } - ->STD_ALT::convertible_to; - { a / pt_b } - ->STD_ALT::convertible_to; - { a %= pt_b } - ->STD_ALT::same_as; - { a /= pt_b } - ->STD_ALT::same_as; + template + concept Integral = OrderedRing && requires(Z a, Z pt_b) { + { a % pt_b } -> STD_ALT::convertible_to; + { a / pt_b } -> STD_ALT::convertible_to; + { a %= pt_b } -> STD_ALT::same_as; + { a /= pt_b } -> STD_ALT::same_as; }; } // namespace fun diff --git a/include/projgeom/ell_object.hpp b/include/projgeom/ell_object.hpp index a6df067..d7c2d01 100644 --- a/include/projgeom/ell_object.hpp +++ b/include/projgeom/ell_object.hpp @@ -55,15 +55,11 @@ class EllipticLine : public PgObject { * * @return EllipticLine */ -constexpr auto EllipticPoint::perp() const -> EllipticLine { - return EllipticLine{this->coord}; -} +constexpr auto EllipticPoint::perp() const -> EllipticLine { return EllipticLine{this->coord}; } /** * @brief Pole * * @return EllipticPoint */ -constexpr auto EllipticLine::perp() const -> EllipticPoint { - return EllipticPoint{this->coord}; -} +constexpr auto EllipticLine::perp() const -> EllipticPoint { return EllipticPoint{this->coord}; } diff --git a/include/projgeom/euclid_plane.hpp b/include/projgeom/euclid_plane.hpp index 6b4f63c..2042e0d 100644 --- a/include/projgeom/euclid_plane.hpp +++ b/include/projgeom/euclid_plane.hpp @@ -53,10 +53,8 @@ namespace fun { * @return Line */ template - requires ProjectivePlaneCoord constexpr auto altitude(const Point &a, - const Line &line_l) -> Line { - return a * fB(line_l); - } + requires ProjectivePlaneCoord + constexpr auto altitude(const Point &a, const Line &line_l) -> Line { return a * fB(line_l); } /** * @brief diff --git a/include/projgeom/euclid_plane_measure.hpp b/include/projgeom/euclid_plane_measure.hpp index 1e29d8d..6cd64d4 100644 --- a/include/projgeom/euclid_plane_measure.hpp +++ b/include/projgeom/euclid_plane_measure.hpp @@ -15,9 +15,9 @@ namespace fun { * @param[in] z2 * @return auto */ - template requires Integral constexpr auto quad1(const K &x1, const K &z1, - const K &x2, - const K &z2) { + template + requires Integral + constexpr auto quad1(const K &x1, const K &z1, const K &x2, const K &z2) { return sq(Fraction(x1, z1) - Fraction(x2, z2)); } @@ -49,7 +49,7 @@ namespace fun { return quad1(a1[0], a1[2], a2[0], a2[2]) + quad1(a1[1], a1[2], a2[1], a2[2]); } - template constexpr auto quadrance_copy(const Args &... args) { + template constexpr auto quadrance_copy(const Args &...args) { return std::make_tuple(quadrance(args.first, args.second)...); } @@ -83,8 +83,7 @@ namespace fun { * @param[in] l2 * @return auto */ - template - constexpr auto spread(const Line &l1, const Line &l2) { + template constexpr auto spread(const Line &l1, const Line &l2) { return sbase(l1, l2, cross2(l1, l2)); } @@ -119,8 +118,7 @@ namespace fun { * @param[in] l2 * @return auto */ - template - constexpr auto cross_s(const Line &l1, const Line &l2) { + template constexpr auto cross_s(const Line &l1, const Line &l2) { return sbase(l1, l2, dot1(l1, l2)); } @@ -133,8 +131,7 @@ namespace fun { * @param[in] b * @return auto */ - template - constexpr auto distance(const Point &a, const Point &b) { + template constexpr auto distance(const Point &a, const Point &b) { return std::sqrt(double(quadrance(a, b))); } diff --git a/include/projgeom/persp_plane.hpp b/include/projgeom/persp_plane.hpp index 830af7a..fceaabb 100644 --- a/include/projgeom/persp_plane.hpp +++ b/include/projgeom/persp_plane.hpp @@ -15,7 +15,7 @@ namespace fun { */ template requires ProjectivePlanePrim // c++20 concept - class persp_euclid_plane : public ck { + class persp_euclid_plane : public ck { using K = Value_type; private: diff --git a/include/projgeom/pg_common.hpp b/include/projgeom/pg_common.hpp index 681bb16..bb2d23e 100644 --- a/include/projgeom/pg_common.hpp +++ b/include/projgeom/pg_common.hpp @@ -56,8 +56,8 @@ namespace fun { * @return Cross product */ template - requires Ring> auto cross(const Point &v, const Point &w) - -> std::array, 3> { + requires Ring> + auto cross(const Point &v, const Point &w) -> std::array, 3> { return {cross0(v, w), -cross1(v, w), cross2(v, w)}; } diff --git a/include/projgeom/pg_concepts.hpp b/include/projgeom/pg_concepts.hpp index cb5e419..743108e 100644 --- a/include/projgeom/pg_concepts.hpp +++ b/include/projgeom/pg_concepts.hpp @@ -12,13 +12,12 @@ namespace fun { * @tparam Point Point * @tparam Line Line */ - template concept ProjectivePlanePrimitive = // - concepts::equality_comparable // - &&requires(const Point &pt_p, const Point &pt_q, const Line &ln_l) { - { pt_p.incident(ln_l) } - ->concepts::convertible_to; // incidence - { pt_p.meet(pt_q) } - ->concepts::convertible_to; // join or meet + template + concept ProjectivePlanePrimitive = // + concepts::equality_comparable // + && requires(const Point &pt_p, const Point &pt_q, const Line &ln_l) { + { pt_p.incident(ln_l) } -> concepts::convertible_to; // incidence + { pt_p.meet(pt_q) } -> concepts::convertible_to; // join or meet }; /** @@ -27,8 +26,9 @@ namespace fun { * @tparam Point Point * @tparam Line Line */ - template concept ProjPlanePrimDual - = ProjectivePlanePrimitive &&ProjectivePlanePrimitive; + template + concept ProjPlanePrimDual + = ProjectivePlanePrimitive && ProjectivePlanePrimitive; /** * @brief Projective plane Concept @@ -37,15 +37,13 @@ namespace fun { * @tparam Point Point * @tparam Line Line */ - template concept ProjectivePlane - = concepts::equality_comparable &&ProjectivePlanePrimitive // - &&requires(const Point &pt_p, const Point &pt_q, const Line &ln_l, const Value &a) { - { pt_p.aux() } - ->concepts::convertible_to; // line not incident with pt_p - { pt_p.dot(ln_l) } - ->concepts::convertible_to; // for basic measurement - { Point::parametrize(a, pt_p, a, pt_q) } - ->concepts::convertible_to; + template + concept ProjectivePlane + = concepts::equality_comparable && ProjectivePlanePrimitive // + && requires(const Point &pt_p, const Point &pt_q, const Line &ln_l, const Value &a) { + { pt_p.aux() } -> concepts::convertible_to; // line not incident with pt_p + { pt_p.dot(ln_l) } -> concepts::convertible_to; // for basic measurement + { Point::parametrize(a, pt_p, a, pt_q) } -> concepts::convertible_to; }; /** @@ -55,7 +53,8 @@ namespace fun { * @tparam Point Point * @tparam Line Line */ - template concept ProjectivePlaneDual - = ProjectivePlane &&ProjectivePlane; + template + concept ProjectivePlaneDual + = ProjectivePlane && ProjectivePlane; } // namespace fun diff --git a/include/projgeom/pg_plane.hpp b/include/projgeom/pg_plane.hpp index 2e91788..bd75004 100644 --- a/include/projgeom/pg_plane.hpp +++ b/include/projgeom/pg_plane.hpp @@ -21,7 +21,7 @@ namespace fun { #if __cpp_concepts >= 201907L requires ProjPlanePrimDual #endif - inline auto check_axiom(const Point &pt_p, const Point &pt_q, const Line &ln_l) -> bool { + inline auto check_axiom(const Point &pt_p, const Point &pt_q, const Line &ln_l) -> bool { if (pt_p != pt_p) return false; if (pt_p.incident(ln_l) != ln_l.incident(pt_p)) return false; if (pt_p.meet(pt_q) != pt_q.meet(pt_p)) return false; @@ -44,8 +44,7 @@ namespace fun { #if __cpp_concepts >= 201907L requires ProjPlanePrimDual #endif - constexpr auto coincident(const Point &pt_p, const Point &pt_q, const Point &pt_r) - -> bool { + constexpr auto coincident(const Point &pt_p, const Point &pt_q, const Point &pt_r) -> bool { return pt_p.meet(pt_q).incident(pt_r); } @@ -62,8 +61,8 @@ namespace fun { #if __cpp_concepts >= 201907L requires ProjPlanePrimDual #endif - constexpr auto check_pappus(const std::array &coline1, - const std::array &coline2) -> bool { + constexpr auto check_pappus(const std::array &coline1, + const std::array &coline2) -> bool { const auto &[pt_a, pt_b, pt_c] = coline1; const auto &[pt_d, pt_e, pt_f] = coline2; const auto pt_g = (pt_a.meet(pt_e)).meet(pt_b.meet(pt_d)); @@ -84,8 +83,7 @@ namespace fun { #if __cpp_concepts >= 201907L requires ProjPlanePrimDual #endif - constexpr auto tri_dual(const std::array &triangle) - -> std::array { + constexpr auto tri_dual(const std::array &triangle) -> std::array { const auto &[a1, a2, a3] = triangle; assert(!coincident(a1, a2, a3)); return {a2.meet(a3), a1.meet(a3), a1.meet(a2)}; @@ -104,8 +102,8 @@ namespace fun { #if __cpp_concepts >= 201907L requires ProjPlanePrimDual #endif - constexpr auto persp(const std::array &tri1, - const std::array &tri2) -> bool { + constexpr auto persp(const std::array &tri1, const std::array &tri2) + -> bool { const auto &[pt_a, pt_b, pt_c] = tri1; const auto &[pt_d, pt_e, pt_f] = tri2; const auto &o = pt_a.meet(pt_d).meet(pt_b.meet(pt_e)); @@ -125,8 +123,8 @@ namespace fun { #if __cpp_concepts >= 201907L requires ProjPlanePrimDual #endif - constexpr auto check_desargue(const std::array &tri1, - const std::array &tri2) -> bool { + constexpr auto check_desargue(const std::array &tri1, + const std::array &tri2) -> bool { const auto trid1 = tri_dual(tri1); const auto trid2 = tri_dual(tri2); const auto bool1 = persp(tri1, tri2); @@ -157,8 +155,8 @@ namespace fun { #if __cpp_concepts >= 201907L requires ProjectivePlaneDual #endif - inline auto check_axiom2(const Point &pt_p, const Point &pt_q, const Line &ln_l, - const Value &a, const Value &b) -> bool { + inline auto check_axiom2(const Point &pt_p, const Point &pt_q, const Line &ln_l, const Value &a, + const Value &b) -> bool { if (pt_p.dot(ln_l) != ln_l.dot(pt_p)) return false; if (pt_p.aux().incident(pt_p)) return false; const auto ln_m = pt_p.meet(pt_q); @@ -180,8 +178,7 @@ namespace fun { #if __cpp_concepts >= 201907L requires ProjectivePlaneDual #endif - constexpr auto harm_conj(const Point &pt_a, const Point &pt_b, const Point &pt_c) - -> Point { + constexpr auto harm_conj(const Point &pt_a, const Point &pt_b, const Point &pt_c) -> Point { assert(coincident(pt_a, pt_b, pt_c)); const auto ab = pt_a.meet(pt_b); const auto lc = ab.aux().meet(pt_c); @@ -203,8 +200,7 @@ namespace fun { #if __cpp_concepts >= 201907L requires ProjectivePlaneDual #endif - constexpr auto involution(const Point &origin, const Line &mirror, const Point &pt_p) - -> Point { + constexpr auto involution(const Point &origin, const Line &mirror, const Point &pt_p) -> Point { const auto po = pt_p.meet(origin); const auto pt_b = po.meet(mirror); return harm_conj(origin, pt_b, pt_p); diff --git a/include/projgeom/pg_point.hpp b/include/projgeom/pg_point.hpp index 58db4fe..67ba58e 100644 --- a/include/projgeom/pg_point.hpp +++ b/include/projgeom/pg_point.hpp @@ -72,8 +72,8 @@ namespace fun { * @param[in] pt_q * @return pg_line<_K> */ - template - constexpr auto join(const pg_point<_K> &pt_p, const pg_point<_K> &pt_q) -> pg_line<_K> { + template constexpr auto join(const pg_point<_K> &pt_p, const pg_point<_K> &pt_q) + -> pg_line<_K> { return pt_p * pt_q; } diff --git a/include/projgeom/proj_plane.hpp b/include/projgeom/proj_plane.hpp index 9ecde3b..879fc64 100644 --- a/include/projgeom/proj_plane.hpp +++ b/include/projgeom/proj_plane.hpp @@ -31,8 +31,8 @@ namespace fun { * @return false */ template - requires ProjectivePlane constexpr auto incident(const Point &pt_p, - const Line &ln_l) -> bool { + requires ProjectivePlane + constexpr auto incident(const Point &pt_p, const Line &ln_l) -> bool { return pt_p.dot(ln_l) == Value_type(0); } @@ -46,7 +46,7 @@ namespace fun { */ template requires(ProjectivePlanePrim &&...) constexpr auto coincident(const Line &ln_l, - const Args &... pt_r) + const Args &...pt_r) -> bool { return (incident(pt_r, ln_l) && ...); } @@ -157,7 +157,8 @@ namespace fun { * @tparam Line */ template - requires ProjectivePlane class Involution { + requires ProjectivePlane + class Involution { using K = Value_type; private: @@ -203,7 +204,8 @@ namespace fun { * @tparam Line */ template - requires ProjectivePlaneGeneric class involution_generic { + requires ProjectivePlaneGeneric + class involution_generic { private: Line _m; Point _o; diff --git a/include/projgeom/proj_plane_concepts.h b/include/projgeom/proj_plane_concepts.h index 18fbf70..692eee6 100644 --- a/include/projgeom/proj_plane_concepts.h +++ b/include/projgeom/proj_plane_concepts.h @@ -18,13 +18,12 @@ namespace fun { * @tparam Point Point * @tparam Line Line */ - template concept ProjectivePlanePrimH - = STD_ALT::equality_comparable &&requires(const Point &pt_p, const Point &pt_q, - const Line &ln_l) { - { incident(pt_p, ln_l) } - ->STD_ALT::convertible_to; // incidence - { pt_p *pt_q } - ->STD_ALT::convertible_to; // join or meet + template + concept ProjectivePlanePrimH + = STD_ALT::equality_comparable && requires(const Point &pt_p, const Point &pt_q, + const Line &ln_l) { + { incident(pt_p, ln_l) } -> STD_ALT::convertible_to; // incidence + { pt_p *pt_q } -> STD_ALT::convertible_to; // join or meet // { pt_p.aux() } -> STD_ALT::convertible_to; // line not incident // with pt_p { pt_p.aux2(pt_q) } -> STD_ALT::convertible_to; // // pt_p pt_r on pt_p * pt_q, pt_r != pt_p and pt_r != pt_q @@ -36,15 +35,17 @@ namespace fun { * @tparam Point Point * @tparam Line Line */ - template concept ProjectivePlanePrim - = ProjectivePlanePrimH &&ProjectivePlanePrimH; + template + concept ProjectivePlanePrim + = ProjectivePlanePrimH && ProjectivePlanePrimH; /** * @brief Shorthand Notation of ProjectivePlane * * @tparam Point Point */ - template concept ProjectivePlanePrim2 + template + concept ProjectivePlanePrim2 = ProjectivePlanePrim>; // Make the compiler // happy @@ -54,13 +55,14 @@ namespace fun { * @tparam Point Point * @tparam Line Line */ - template concept ProjectivePlaneGenericH - = ProjectivePlanePrimH &&requires(const Point &pt_p, const Point &pt_q) { - { pt_p.aux() } - ->STD_ALT::convertible_to; // line not incident with pt_p - { pt_p.aux2(pt_q) } - ->STD_ALT::convertible_to; // pt_p pt_r on pt_p * pt_q, - // pt_r != pt_p and pt_r != pt_q + template + concept ProjectivePlaneGenericH + = ProjectivePlanePrimH && requires(const Point &pt_p, const Point &pt_q) { + { pt_p.aux() } -> STD_ALT::convertible_to; // line not incident with pt_p + { + pt_p.aux2(pt_q) + } -> STD_ALT::convertible_to; // pt_p pt_r on pt_p * pt_q, + // pt_r != pt_p and pt_r != pt_q }; /** @@ -69,15 +71,17 @@ namespace fun { * @tparam Point Point * @tparam Line Line */ - template concept ProjectivePlaneGeneric - = ProjectivePlaneGenericH &&ProjectivePlaneGenericH; + template + concept ProjectivePlaneGeneric + = ProjectivePlaneGenericH && ProjectivePlaneGenericH; /** * @brief Shorthand Notation of ProjectivePlane * * @tparam Point Point */ - template concept ProjectivePlaneGeneric2 + template + concept ProjectivePlaneGeneric2 = ProjectivePlaneGeneric>; // Make the compiler // happy @@ -87,21 +91,20 @@ namespace fun { * @tparam Point Point * @tparam Line Line */ - template concept ProjectivePlaneH - = STD_ALT::equality_comparable &&requires(const Point &pt_p, const Point &pt_q, - const Line &ln_l, - const Value_type &pt_a) { + template + concept ProjectivePlaneH + = STD_ALT::equality_comparable && requires(const Point &pt_p, const Point &pt_q, + const Line &ln_l, + const Value_type &pt_a) { typename Value_type; // { Point(pt_p) } -> Point; // copyable // { incident(pt_p, ln_l) } -> bool; // incidence - { pt_p *pt_q } - ->STD_ALT::convertible_to; // join or meet - { pt_p.dot(ln_l) } - ->STD_ALT::convertible_to>; // for measurement - { pt_p.aux() } - ->STD_ALT::convertible_to; // line not incident with pt_p - { parametrize(pt_a, pt_p, pt_a, pt_q) } - ->STD_ALT::convertible_to; // module computation + { pt_p *pt_q } -> STD_ALT::convertible_to; // join or meet + { pt_p.dot(ln_l) } -> STD_ALT::convertible_to>; // for measurement + { pt_p.aux() } -> STD_ALT::convertible_to; // line not incident with pt_p + { + parametrize(pt_a, pt_p, pt_a, pt_q) + } -> STD_ALT::convertible_to; // module computation }; /** @@ -110,8 +113,8 @@ namespace fun { * @tparam Point Point * @tparam Line Line */ - template concept ProjectivePlane - = ProjectivePlaneH &&ProjectivePlaneH; + template + concept ProjectivePlane = ProjectivePlaneH && ProjectivePlaneH; /* axiom(Point pt_p, Point pt_q, Point pt_r, Line ln_l) { @@ -124,7 +127,8 @@ namespace fun { * * @tparam Point Point */ - template concept ProjectivePlane2 + template + concept ProjectivePlane2 = ProjectivePlane>; // Make the compiler happy /** @@ -133,12 +137,12 @@ namespace fun { * @tparam Point Point * @tparam Line Line */ - template concept ProjectivePlaneCoordH - = ProjectivePlaneH &&requires(const Point &pt_p, size_t idx) { + template + concept ProjectivePlaneCoordH + = ProjectivePlaneH && requires(const Point &pt_p, size_t idx) { typename Value_type; - { pt_p[idx] } - ->STD_ALT::convertible_to>; // for coordinate acess + { pt_p[idx] } -> STD_ALT::convertible_to>; // for coordinate acess }; /** @@ -147,15 +151,17 @@ namespace fun { * @tparam Point Point * @tparam Line Line */ - template concept ProjectivePlaneCoord - = ProjectivePlaneCoordH &&ProjectivePlaneCoordH; + template + concept ProjectivePlaneCoord + = ProjectivePlaneCoordH && ProjectivePlaneCoordH; /** * @brief Shorthand Notation of ProjectivePlane * * @tparam Point Point */ - template concept ProjectivePlaneCoord2 + template + concept ProjectivePlaneCoord2 = ProjectivePlaneCoord>; // Make the compiler // happy diff --git a/include/projgeom/proj_plane_measure.hpp b/include/projgeom/proj_plane_measure.hpp index a0591ea..c276ea2 100644 --- a/include/projgeom/proj_plane_measure.hpp +++ b/include/projgeom/proj_plane_measure.hpp @@ -45,9 +45,8 @@ namespace fun { * @todo rewrite by projecting to the y-axis first [:2] */ template - requires ProjectivePlane constexpr auto x_ratio(const Point &A, const Point &B, - const Line &line_l, - const Line &line_m) { + requires ProjectivePlane + constexpr auto x_ratio(const Point &A, const Point &B, const Line &line_l, const Line &line_m) { return ratio_ratio(A.dot(line_l), A.dot(line_m), B.dot(line_l), B.dot(line_m)); }