Skip to content

Commit

Permalink
apply fix-format
Browse files Browse the repository at this point in the history
  • Loading branch information
luk036 committed Dec 1, 2024
1 parent 1804340 commit 68594cc
Show file tree
Hide file tree
Showing 17 changed files with 94 additions and 98 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ jobs:
- name: Install dependencies
run: sudo apt-get install libboost-dev


- name: Install format dependencies
run: |
sudo apt-get install clang-format
pip3 install cmake_format==0.6.13 pyyaml
run: pip3 install clang-format==18.1.2 cmake_format==0.6.13 pyyaml

- name: configure
run: cmake -S. -Bbuild
Expand Down
8 changes: 4 additions & 4 deletions include/projgeom/ck_concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace fun {
concept CayleyKleinPlanePrimitive = //
ProjectivePlanePrimitive<Point, Line> //
&& requires(const Point &pt_p, const Line &ln_l) {
{ pt_p.perp() } -> concepts::convertible_to<Line>; // pole or polar
};
{ pt_p.perp() } -> concepts::convertible_to<Line>; // pole or polar
};

/**
* @brief Cayley-Klein plane Concept (full)
Expand All @@ -38,8 +38,8 @@ namespace fun {
concept CayleyKleinPlane = //
ProjectivePlane<Value, Point, Line> //
&& requires(const Point &pt_p, const Line &ln_l) {
{ pt_p.perp() } -> concepts::convertible_to<Line>; // pole or polar
};
{ pt_p.perp() } -> concepts::convertible_to<Line>; // pole or polar
};

/**
* @brief Cayley-Klein plane Concept (full)
Expand Down
10 changes: 5 additions & 5 deletions include/projgeom/ck_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace fun {
*/
template <class Line, class Point = typename Line::Dual>
#if __cpp_concepts >= 201907L
requires CayleyKleinPlanePrimitiveDual<Line, Point>
requires CayleyKleinPlanePrimitiveDual<Line, Point>
#endif
constexpr auto is_perpendicular(const Line &m1, const Line &m2) -> bool {
return m1.perp().incident(m2);
Expand All @@ -29,7 +29,7 @@ namespace fun {
*/
template <class Point, class Line>
#if __cpp_concepts >= 201907L
requires CayleyKleinPlanePrimitiveDual<Point, Line>
requires CayleyKleinPlanePrimitiveDual<Point, Line>
#endif
constexpr auto altitude(const Point &pt_p, const Line &ln_m) -> Line {
return ln_m.perp().meet(pt_p);
Expand All @@ -43,7 +43,7 @@ namespace fun {
*/
template <class Point, class Line = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires CayleyKleinPlanePrimitiveDual<Point, Line>
requires CayleyKleinPlanePrimitiveDual<Point, Line>
#endif
constexpr auto orthocenter(const std::array<Point, 3> &triangle) -> Point {
const auto &[a1, a2, a3] = triangle;
Expand All @@ -61,7 +61,7 @@ namespace fun {
*/
template <class Point, class Line>
#if __cpp_concepts >= 201907L
requires CayleyKleinPlanePrimitiveDual<Point, Line>
requires CayleyKleinPlanePrimitiveDual<Point, Line>
#endif
constexpr auto tri_altitude(const std::array<Point, 3> &triangle) -> std::array<Line, 3> {
const auto [l1, l2, l3] = tri_dual(triangle);
Expand All @@ -75,7 +75,7 @@ namespace fun {

template <typename Value, class Point, class Line = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires CayleyKleinPlaneDual<Value, Point, Line>
requires CayleyKleinPlaneDual<Value, Point, Line>
#endif
constexpr auto reflect(const Line &mirror, const Point &pt_p) -> Point {
return involution(mirror.perp(), mirror, pt_p);
Expand Down
2 changes: 1 addition & 1 deletion include/projgeom/common_concepts.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace fun {
{ t.size() } -> STD_ALT::convertible_to<std::size_t>;
{ t.empty() } -> STD_ALT::convertible_to<bool>;
{ t.back() } -> STD_ALT::same_as<Element_type<T>>;
{ t.push_back(x) };
{t.push_back(x)};
};

template <typename K>
Expand Down
18 changes: 8 additions & 10 deletions include/projgeom/euclid_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ 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 All @@ -76,8 +74,8 @@ namespace fun {
* @param[in] triangle
* @return Point
*/
template <ProjectivePlaneCoord2 Point>
constexpr auto orthocenter(const Triple<Point> &triangle) -> Point {
template <ProjectivePlaneCoord2 Point> constexpr auto orthocenter(const Triple<Point> &triangle)
-> Point {
const auto &[a1, a2, a3] = triangle;
const auto t1 = altitude(a1, a2 * a3);
const auto t2 = altitude(a2, a1 * a3);
Expand All @@ -101,8 +99,8 @@ namespace fun {
* @param[in] b
* @return Point
*/
template <ProjectivePlaneCoord2 Point>
constexpr auto midpoint(const Point &a, const Point &b) -> Point {
template <ProjectivePlaneCoord2 Point> constexpr auto midpoint(const Point &a, const Point &b)
-> Point {
return parametrize(b[2], a, a[2], b);
}

Expand Down Expand Up @@ -155,8 +153,8 @@ namespace fun {
* @param[in] d
* @return auto
*/
template <typename _Q>
constexpr auto cqq(const _Q &a, const _Q &b, const _Q &c, const _Q &d) -> std::array<_Q, 2> {
template <typename _Q> constexpr auto cqq(const _Q &a, const _Q &b, const _Q &c, const _Q &d)
-> std::array<_Q, 2> {
const auto t1 = 4 * a * b;
const auto t2 = 4 * c * d;
auto line_m = (t1 + t2) - sq(a + b - c - d);
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>
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
4 changes: 2 additions & 2 deletions include/projgeom/fractions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,8 @@ namespace fun {
* @param[in] frac
* @return _Stream&
*/
template <typename _Stream>
friend auto operator<<(_Stream &os, const Fraction &frac) -> _Stream & {
template <typename _Stream> friend auto operator<<(_Stream &os, const Fraction &frac)
-> _Stream & {
os << "(" << frac.num() << "/" << frac.den() << ")";
return os;
}
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
6 changes: 3 additions & 3 deletions 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 Expand Up @@ -86,8 +86,8 @@ namespace fun {
* @return lamda*v + mu*w
*/
template <Ring _T, Ring _K> auto plucker_c(const _T &lambda, const std::array<_K, 3> &v1,
const _T &mu,
const std::array<_K, 3> &v2) -> std::array<_K, 3> {
const _T &mu, const std::array<_K, 3> &v2)
-> std::array<_K, 3> {
const auto &[x1, y1, z1] = v1;
const auto &[x2, y2, z2] = v2;
return {lambda * x1 + mu * x2, lambda * y1 + mu * y2, lambda * z1 + mu * z2};
Expand Down
16 changes: 8 additions & 8 deletions include/projgeom/pg_concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ namespace fun {
concept ProjectivePlanePrimitive = //
concepts::equality_comparable<Point> //
&& requires(const Point &pt_p, const Point &pt_q, const Line &ln_l) {
{ pt_p.incident(ln_l) } -> concepts::convertible_to<bool>; // incidence
{ pt_p.meet(pt_q) } -> concepts::convertible_to<Line>; // join or meet
};
{ pt_p.incident(ln_l) } -> concepts::convertible_to<bool>; // incidence
{ pt_p.meet(pt_q) } -> concepts::convertible_to<Line>; // join or meet
};

/**
* @brief Projective plane Concept (full)
Expand All @@ -40,11 +40,11 @@ namespace fun {
template <typename Value, class Point, class Line>
concept ProjectivePlane
= concepts::equality_comparable<Point> && ProjectivePlanePrimitive<Point, Line> //
&& requires(const Point &pt_p, const Point &pt_q, const Line &ln_l, const Value &a) {
{ pt_p.aux() } -> concepts::convertible_to<Line>; // line not incident with pt_p
{ pt_p.dot(ln_l) } -> concepts::convertible_to<Value>; // for basic measurement
{ Point::parametrize(a, pt_p, a, pt_q) } -> concepts::convertible_to<Point>;
};
&& requires(const Point &pt_p, const Point &pt_q, const Line &ln_l, const Value &a) {
{ pt_p.aux() } -> concepts::convertible_to<Line>; // line not incident with pt_p
{ pt_p.dot(ln_l) } -> concepts::convertible_to<Value>; // for basic measurement
{ Point::parametrize(a, pt_p, a, pt_q) } -> concepts::convertible_to<Point>;
};

/**
* @brief Projective plane dual Concept
Expand Down
4 changes: 2 additions & 2 deletions include/projgeom/pg_line.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ namespace fun {
};

/// Return meet of two lines.
template <Ring _K>
constexpr auto meet(const pg_line<_K> &ln_l, const pg_line<_K> &ln_m) -> pg_point<_K> {
template <Ring _K> constexpr auto meet(const pg_line<_K> &ln_l, const pg_line<_K> &ln_m)
-> pg_point<_K> {
return ln_l * ln_m;
}

Expand Down
8 changes: 4 additions & 4 deletions include/projgeom/pg_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* @param[in] pt_b
* @return int64_t
*/
constexpr auto dot(const std::array<int64_t, 3> &pt_a,
const std::array<int64_t, 3> &pt_b) -> int64_t {
constexpr auto dot(const std::array<int64_t, 3> &pt_a, const std::array<int64_t, 3> &pt_b)
-> int64_t {
return pt_a[0] * pt_b[0] + pt_a[1] * pt_b[1] + pt_a[2] * pt_b[2];
}

Expand All @@ -25,8 +25,8 @@ constexpr auto dot(const std::array<int64_t, 3> &pt_a,
* @param[in] pt_b
* @return std::array<int64_t, 3>
*/
constexpr auto cross(const std::array<int64_t, 3> &pt_a,
const std::array<int64_t, 3> &pt_b) -> std::array<int64_t, 3> {
constexpr auto cross(const std::array<int64_t, 3> &pt_a, const std::array<int64_t, 3> &pt_b)
-> std::array<int64_t, 3> {
return {
pt_a[1] * pt_b[2] - pt_a[2] * pt_b[1],
pt_a[2] * pt_b[0] - pt_a[0] * pt_b[2],
Expand Down
22 changes: 11 additions & 11 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 Line>
#if __cpp_concepts >= 201907L
requires ProjPlanePrimDual<Point, Line>
requires ProjPlanePrimDual<Point, Line>
#endif
inline auto check_axiom(const Point &pt_p, const Point &pt_q, const Line &ln_l) -> bool {
if (pt_p != pt_p) return false;
Expand All @@ -42,7 +42,7 @@ namespace fun {
*/
template <class Point, class Line = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires ProjPlanePrimDual<Point, Line>
requires ProjPlanePrimDual<Point, Line>
#endif
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);
Expand All @@ -59,7 +59,7 @@ namespace fun {
*/
template <class Point, class Line = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires ProjPlanePrimDual<Point, Line>
requires ProjPlanePrimDual<Point, Line>
#endif
constexpr auto check_pappus(const std::array<Point, 3> &coline1,
const std::array<Point, 3> &coline2) -> bool {
Expand All @@ -81,7 +81,7 @@ namespace fun {
*/
template <class Point, class Line = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires ProjPlanePrimDual<Point, Line>
requires ProjPlanePrimDual<Point, Line>
#endif
constexpr auto tri_dual(const std::array<Point, 3> &triangle) -> std::array<Line, 3> {
const auto &[a1, a2, a3] = triangle;
Expand All @@ -100,10 +100,10 @@ namespace fun {
*/
template <class Point, class Line = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires ProjPlanePrimDual<Point, Line>
requires ProjPlanePrimDual<Point, Line>
#endif
constexpr auto persp(const std::array<Point, 3> &tri1,
const std::array<Point, 3> &tri2) -> bool {
constexpr auto persp(const std::array<Point, 3> &tri1, const std::array<Point, 3> &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));
Expand All @@ -121,7 +121,7 @@ namespace fun {
*/
template <class Point, class Line = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires ProjPlanePrimDual<Point, Line>
requires ProjPlanePrimDual<Point, Line>
#endif
constexpr auto check_desargue(const std::array<Point, 3> &tri1,
const std::array<Point, 3> &tri2) -> bool {
Expand Down Expand Up @@ -153,7 +153,7 @@ namespace fun {
*/
template <typename Value, class Point, class Line>
#if __cpp_concepts >= 201907L
requires ProjectivePlaneDual<Value, Point, Line>
requires ProjectivePlaneDual<Value, Point, Line>
#endif
inline auto check_axiom2(const Point &pt_p, const Point &pt_q, const Line &ln_l, const Value &a,
const Value &b) -> bool {
Expand All @@ -176,7 +176,7 @@ namespace fun {
*/
template <typename Value, class Point, class Line = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires ProjectivePlaneDual<Value, Point, Line>
requires ProjectivePlaneDual<Value, Point, Line>
#endif
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));
Expand All @@ -198,7 +198,7 @@ namespace fun {
*/
template <typename Value, class Point, class Line>
#if __cpp_concepts >= 201907L
requires ProjectivePlaneDual<Value, Point, Line>
requires ProjectivePlaneDual<Value, Point, Line>
#endif
constexpr auto involution(const Point &origin, const Line &mirror, const Point &pt_p) -> Point {
const auto po = pt_p.meet(origin);
Expand Down
4 changes: 2 additions & 2 deletions include/projgeom/pg_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ namespace fun {
* @param[in] pt_q
* @return pg_line<_K>
*/
template <Ring _K>
constexpr auto join(const pg_point<_K> &pt_p, const pg_point<_K> &pt_q) -> pg_line<_K> {
template <Ring _K> constexpr auto join(const pg_point<_K> &pt_p, const pg_point<_K> &pt_q)
-> pg_line<_K> {
return pt_p * pt_q;
}

Expand Down
17 changes: 9 additions & 8 deletions include/projgeom/proj_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace fun {
* @return false
*/
template <typename Point, typename Line>
requires ProjectivePlane<Point, Line>
requires ProjectivePlane<Point, Line>
constexpr auto incident(const Point &pt_p, const Line &ln_l) -> bool {
return pt_p.dot(ln_l) == Value_type<Point>(0);
}
Expand All @@ -45,8 +45,9 @@ namespace fun {
* @return false otherwise
*/
template <typename Line, typename... Args>
requires(ProjectivePlanePrim<Line, Args> && ...)
constexpr auto coincident(const Line &ln_l, const Args &...pt_r) -> bool {
requires(ProjectivePlanePrim<Line, Args> &&...) constexpr auto coincident(const Line &ln_l,
const Args &...pt_r)
-> bool {
return (incident(pt_r, ln_l) && ...);
}

Expand Down Expand Up @@ -143,9 +144,9 @@ namespace fun {
* @return constexpr auto
*
*/
template <ProjectivePlane2 Point> constexpr auto is_harmonic(const Point &A, const Point &B,
const Point &C,
const Point &D) -> bool {
template <ProjectivePlane2 Point>
constexpr auto is_harmonic(const Point &A, const Point &B, const Point &C, const Point &D)
-> bool {
return harm_conj(A, B, C) == D;
}

Expand All @@ -156,7 +157,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 @@ -203,7 +204,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
Loading

0 comments on commit 68594cc

Please sign in to comment.