Skip to content

Commit

Permalink
apply clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
luk036 committed Aug 15, 2023
1 parent 783508a commit e8c0701
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 81 deletions.
15 changes: 8 additions & 7 deletions include/projgeom/ck_concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ namespace fun {
* @tparam L Line
*/
template <class Point, class L = typename Point::Dual>
concept CayleyKleinPlanePrimitive = //
concept CayleyKleinPlanePrimitive = //
ProjectivePlanePrimitive<Point, L> //
&& requires(const Point &p, const L &l) {
{ p.perp() } -> concepts::convertible_to<L>;
};
{ p.perp() } -> concepts::convertible_to<L>;
};

/**
* @brief C-K plane Concept (full)
Expand All @@ -25,7 +25,8 @@ namespace fun {
* @tparam L Line
*/
template <class Point, class L = typename Point::Dual>
concept CKPlanePrimDual = CayleyKleinPlanePrimitive<Point, L> && CayleyKleinPlanePrimitive<L, Point>;
concept CKPlanePrimDual
= CayleyKleinPlanePrimitive<Point, L> && CayleyKleinPlanePrimitive<L, Point>;

/**
* @brief C-K plane Concept
Expand All @@ -34,11 +35,11 @@ namespace fun {
* @tparam L Line
*/
template <class V, class Point, class L = typename Point::Dual>
concept CayleyKleinPlane = //
concept CayleyKleinPlane = //
ProjectivePlane<V, Point, L> //
&& requires(const Point &p, const L &l) {
{ p.perp() } -> concepts::convertible_to<L>;
};
{ p.perp() } -> concepts::convertible_to<L>;
};

/**
* @brief C-K plane Concept (full)
Expand Down
6 changes: 4 additions & 2 deletions include/projgeom/euclid_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ namespace fun {
* @return Line
*/
template <typename Point, typename Line>
requires ProjectivePlaneCoord<Point, Line>
constexpr auto altitude(const Point &a, const Line &line_l) -> Line { return a * fB(line_l); }
requires ProjectivePlaneCoord<Point, Line>
constexpr auto altitude(const Point &a, const Line &line_l) -> Line {
return a * fB(line_l);
}

/**
* @brief
Expand Down
2 changes: 1 addition & 1 deletion include/projgeom/euclid_plane_measure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace fun {
* @return auto
*/
template <typename K>
requires Integral<K>
requires Integral<K>
inline constexpr auto quad1(const K &x1, const K &z1, const K &x2, const K &z2) {
return sq(Fraction<K>(x1, z1) - Fraction<K>(x2, z2));
}
Expand Down
2 changes: 1 addition & 1 deletion include/projgeom/persp_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace fun {
* @tparam Point::Dual
*/
template <typename Point, typename Line = typename Point::Dual>
requires ProjectivePlanePrim<Point, Line> // c++20 concept
requires ProjectivePlanePrim<Point, Line> // c++20 concept
class persp_euclid_plane : public ck<Point, Line, persp_euclid_plane> {
using K = Value_type<Point>;

Expand Down
2 changes: 1 addition & 1 deletion include/projgeom/pg_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace fun {
* @return Cross product
*/
template <typename Point>
requires Ring<Value_type<Point>>
requires Ring<Value_type<Point>>
auto cross(const Point &v, const Point &w) -> std::array<Value_type<Point>, 3> {
return {cross0(v, w), -cross1(v, w), cross2(v, w)};
}
Expand Down
24 changes: 13 additions & 11 deletions include/projgeom/pg_concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ namespace fun {
* @tparam L Line
*/
template <class Point, class L>
concept ProjectivePlanePrimitive = //
concept ProjectivePlanePrimitive = //
concepts::equality_comparable<Point> //
&& requires(const Point &p, const Point &q, const L &l) {
{ p.incident(l) } -> concepts::convertible_to<bool>; // incidence
{ p.meet(q) } -> concepts::convertible_to<L>; // join or meet
};
{ p.incident(l) } -> concepts::convertible_to<bool>; // incidence
{ p.meet(q) } -> concepts::convertible_to<L>; // join or meet
};

/**
* @brief Projective plane Concept (full)
Expand All @@ -27,7 +27,8 @@ namespace fun {
* @tparam L Line
*/
template <class Point, class L>
concept ProjPlanePrimDual = ProjectivePlanePrimitive<Point, L> && ProjectivePlanePrimitive<L, Point>;
concept ProjPlanePrimDual
= ProjectivePlanePrimitive<Point, L> && ProjectivePlanePrimitive<L, Point>;

/**
* @brief Projective plane Concept
Expand All @@ -37,12 +38,13 @@ namespace fun {
* @tparam L Line
*/
template <typename V, class Point, class L>
concept ProjectivePlane = concepts::equality_comparable<Point> && ProjectivePlanePrimitive<Point, L> //
&& requires(const Point &p, const Point &q, const L &l, const V &a) {
{ p.aux() } -> concepts::convertible_to<L>; // line not incident with p
{ p.dot(l) } -> concepts::convertible_to<V>; // for basic measurement
{ Point::plucker(a, p, a, q) } -> concepts::convertible_to<Point>;
};
concept ProjectivePlane
= concepts::equality_comparable<Point> && ProjectivePlanePrimitive<Point, L> //
&& requires(const Point &p, const Point &q, const L &l, const V &a) {
{ p.aux() } -> concepts::convertible_to<L>; // line not incident with p
{ p.dot(l) } -> concepts::convertible_to<V>; // for basic measurement
{ Point::plucker(a, p, a, q) } -> concepts::convertible_to<Point>;
};

/**
* @brief Projective plane dual Concept
Expand Down
8 changes: 5 additions & 3 deletions include/projgeom/pg_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ template <typename Point, typename L> struct PgObject {
* @return true
* @return false
*/
friend constexpr auto operator!=(const Point &lhs, const Point &rhs) -> bool { return !(lhs == rhs); }
friend constexpr auto operator!=(const Point &lhs, const Point &rhs) -> bool {
return !(lhs == rhs);
}

/**
* @brief
Expand All @@ -116,8 +118,8 @@ template <typename Point, typename L> struct PgObject {
* @param[in] q
* @return Point
*/
static constexpr auto plucker(const int64_t &ld, const Point &p, const int64_t &mu, const Point &q)
-> Point {
static constexpr auto plucker(const int64_t &ld, const Point &p, const int64_t &mu,
const Point &q) -> Point {
return Point{::plckr(ld, p.coord, mu, q.coord)};
}

Expand Down
32 changes: 17 additions & 15 deletions include/projgeom/pg_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace fun {
*/
template <class Point, class L>
#if __cpp_concepts >= 201907L
requires ProjPlanePrimDual<Point, L>
requires ProjPlanePrimDual<Point, L>
#endif
inline auto check_axiom(const Point &p, const Point &q, const L &l) -> bool {
if (p != p) return false;
Expand All @@ -42,7 +42,7 @@ namespace fun {
*/
template <class Point, class L = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires ProjPlanePrimDual<Point, L>
requires ProjPlanePrimDual<Point, L>
#endif
inline constexpr auto coincident(const Point &p, const Point &q, const Point &r) -> bool {
return p.meet(q).incident(r);
Expand All @@ -59,10 +59,10 @@ namespace fun {
*/
template <class Point, class L = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires ProjPlanePrimDual<Point, L>
requires ProjPlanePrimDual<Point, L>
#endif
inline constexpr auto check_pappus(const std::array<Point, 3> &co1, const std::array<Point, 3> &co2)
-> bool {
inline constexpr auto check_pappus(const std::array<Point, 3> &co1,
const std::array<Point, 3> &co2) -> bool {
const auto &[a, b, c] = co1;
const auto &[d, e, f] = co2;
const auto g = (a.meet(e)).meet(b.meet(d));
Expand All @@ -81,7 +81,7 @@ namespace fun {
*/
template <class Point, class L = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires ProjPlanePrimDual<Point, L>
requires ProjPlanePrimDual<Point, L>
#endif
inline constexpr auto tri_dual(const std::array<Point, 3> &tri) -> std::array<L, 3> {
const auto &[a1, a2, a3] = tri;
Expand All @@ -100,7 +100,7 @@ namespace fun {
*/
template <class Point, class L = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires ProjPlanePrimDual<Point, L>
requires ProjPlanePrimDual<Point, L>
#endif
inline constexpr auto persp(const std::array<Point, 3> &tri1, const std::array<Point, 3> &tri2)
-> bool {
Expand All @@ -121,10 +121,10 @@ namespace fun {
*/
template <class Point, class L = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires ProjPlanePrimDual<Point, L>
requires ProjPlanePrimDual<Point, L>
#endif
inline constexpr auto check_desargue(const std::array<Point, 3> &tri1, const std::array<Point, 3> &tri2)
-> bool {
inline constexpr auto check_desargue(const std::array<Point, 3> &tri1,
const std::array<Point, 3> &tri2) -> bool {
const auto trid1 = tri_dual(tri1);
const auto trid2 = tri_dual(tri2);
const auto b1 = persp(tri1, tri2);
Expand Down Expand Up @@ -153,9 +153,10 @@ namespace fun {
*/
template <typename V, class Point, class L>
#if __cpp_concepts >= 201907L
requires ProjPlaneDual<V, Point, L>
requires ProjPlaneDual<V, Point, L>
#endif
inline auto check_axiom2(const Point &p, const Point &q, const L &l, const V &a, const V &b) -> bool {
inline auto check_axiom2(const Point &p, const Point &q, const L &l, const V &a, const V &b)
-> bool {
if (p.dot(l) != l.dot(p)) return false;
if (p.aux().incident(p)) return false;
const auto m = p.meet(q);
Expand All @@ -175,7 +176,7 @@ namespace fun {
*/
template <typename V, class Point, class L = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires ProjPlaneDual<V, Point, L>
requires ProjPlaneDual<V, Point, L>
#endif
inline constexpr auto harm_conj(const Point &a, const Point &b, const Point &c) -> Point {
assert(coincident(a, b, c));
Expand All @@ -197,9 +198,10 @@ namespace fun {
*/
template <typename V, class Point, class L>
#if __cpp_concepts >= 201907L
requires ProjPlaneDual<V, Point, L>
requires ProjPlaneDual<V, Point, L>
#endif
inline constexpr auto involution(const Point &origin, const L &mirror, const Point &p) -> Point {
inline constexpr auto involution(const Point &origin, const L &mirror, const Point &p)
-> Point {
const auto po = p.meet(origin);
const auto b = po.meet(mirror);
return harm_conj(origin, b, p);
Expand Down
11 changes: 5 additions & 6 deletions include/projgeom/proj_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace fun {
* @return false
*/
template <typename Point, typename Line>
requires ProjectivePlane<Point, Line>
requires ProjectivePlane<Point, Line>
constexpr auto incident(const Point &point_p, const Line &line_l) -> bool {
return point_p.dot(line_l) == Value_type<Point>(0);
}
Expand All @@ -39,9 +39,8 @@ namespace fun {
* @return false otherwise
*/
template <typename Line, typename... Args>
requires(ProjectivePlanePrim<Line, Args> &&...) constexpr auto coincident(const Line &line_l,
const Args &...r)
-> bool {
requires(ProjectivePlanePrim<Line, Args> && ...)
constexpr auto coincident(const Line &line_l, const Args &...r) -> bool {
return (incident(r, line_l) && ...);
}

Expand Down Expand Up @@ -151,7 +150,7 @@ namespace fun {
* @tparam Line
*/
template <typename Point, typename Line>
requires ProjectivePlane<Point, Line>
requires ProjectivePlane<Point, Line>
class Involution {
using K = Value_type<Point>;

Expand Down Expand Up @@ -198,7 +197,7 @@ namespace fun {
* @tparam Line
*/
template <typename Point, typename Line>
requires ProjectivePlaneGeneric<Point, Line>
requires ProjectivePlaneGeneric<Point, Line>
class involution_generic {
private:
Line _m;
Expand Down
73 changes: 40 additions & 33 deletions include/projgeom/proj_plane_concepts.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ namespace fun {
*/
template <class Point, class Line>
concept ProjectivePlanePrimH
= STD_ALT::equality_comparable<Point> && requires(const Point &point_p,
const Point &point_q,
const Line &line_l) {
{ incident(point_p, line_l) } -> STD_ALT::convertible_to<bool>; // incidence
{ point_p *point_q } -> STD_ALT::convertible_to<Line>; // join or meet
// { point_p.aux() } -> STD_ALT::convertible_to<Line>; // line not incident
// with point_p { point_p.aux2(point_q) } -> STD_ALT::convertible_to<Point>;
// // point_p r on point_p * point_q, r != point_p and r != point_q
};
= STD_ALT::equality_comparable<Point>
&& requires(const Point &point_p, const Point &point_q, const Line &line_l) {
{ incident(point_p, line_l) } -> STD_ALT::convertible_to<bool>; // incidence
{ point_p *point_q } -> STD_ALT::convertible_to<Line>; // join or meet
// { point_p.aux() } -> STD_ALT::convertible_to<Line>; // line not incident
// with point_p { point_p.aux2(point_q) } -> STD_ALT::convertible_to<Point>;
// // point_p r on point_p * point_q, r != point_p and r != point_q
};

/**
* @brief Projective plane Concept (full)
Expand Down Expand Up @@ -58,14 +57,16 @@ namespace fun {
*/
template <class Point, class Line = typename Point::Dual>
concept ProjectivePlaneGenericH
= ProjectivePlanePrimH<Point, Line> && requires(const Point &point_p,
const Point &point_q) {
{ point_p.aux() } -> STD_ALT::convertible_to<Line>; // line not incident with point_p
{
point_p.aux2(point_q)
} -> STD_ALT::convertible_to<Point>; // point_p r on point_p * point_q,
// r != point_p and r != point_q
};
= ProjectivePlanePrimH<Point, Line>
&& requires(const Point &point_p, const Point &point_q) {
{
point_p.aux()
} -> STD_ALT::convertible_to<Line>; // line not incident with point_p
{
point_p.aux2(point_q)
} -> STD_ALT::convertible_to<Point>; // point_p r on point_p * point_q,
// r != point_p and r != point_q
};

/**
* @brief Projective plane Concept (full)
Expand Down Expand Up @@ -95,19 +96,23 @@ namespace fun {
*/
template <class Point, class Line>
concept ProjectivePlaneH
= STD_ALT::equality_comparable<Point> && requires(const Point &point_p,
const Point &point_q, const Line &line_l,
const Value_type<Point> &a) {
typename Value_type<Point>;
// { Point(point_p) } -> Point; // copyable
// { incident(point_p, line_l) } -> bool; // incidence
{ point_p *point_q } -> STD_ALT::convertible_to<Line>; // join or meet
{ point_p.dot(line_l) } -> STD_ALT::convertible_to<Value_type<Point>>; // for measurement
{ point_p.aux() } -> STD_ALT::convertible_to<Line>; // line not incident with point_p
{
plucker(a, point_p, a, point_q)
} -> STD_ALT::convertible_to<Point>; // module computation
};
= STD_ALT::equality_comparable<Point>
&& requires(const Point &point_p, const Point &point_q, const Line &line_l,
const Value_type<Point> &a) {
typename Value_type<Point>;
// { Point(point_p) } -> Point; // copyable
// { incident(point_p, line_l) } -> bool; // incidence
{ point_p *point_q } -> STD_ALT::convertible_to<Line>; // join or meet
{
point_p.dot(line_l)
} -> STD_ALT::convertible_to<Value_type<Point>>; // for measurement
{
point_p.aux()
} -> STD_ALT::convertible_to<Line>; // line not incident with point_p
{
plucker(a, point_p, a, point_q)
} -> STD_ALT::convertible_to<Point>; // module computation
};

/**
* @brief Projective plane Concept (full)
Expand Down Expand Up @@ -142,10 +147,12 @@ namespace fun {
template <class Point, class Line>
concept ProjectivePlaneCoordH
= ProjectivePlaneH<Point, Line> && requires(const Point &point_p, size_t idx) {
typename Value_type<Point>;
typename Value_type<Point>;

{ point_p[idx] } -> STD_ALT::convertible_to<Value_type<Point>>; // for coordinate acess
};
{
point_p[idx]
} -> STD_ALT::convertible_to<Value_type<Point>>; // for coordinate acess
};

/**
* @brief Projective plane Concept (full)
Expand Down
2 changes: 1 addition & 1 deletion include/projgeom/proj_plane_measure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace fun {
* @todo rewrite by projecting to the y-axis first [:2]
*/
template <typename Point, typename Line>
requires ProjectivePlane<Point, Line>
requires ProjectivePlane<Point, Line>
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));
}
Expand Down

0 comments on commit e8c0701

Please sign in to comment.