10#if __cpp_concepts >= 201907L
24 template <
class Po
int,
class Line>
25#if __cpp_concepts >= 201907L
26 requires ProjPlanePrimDual<Point, Line>
28 inline auto check_axiom(
const Point& pt_p,
const Point& pt_q,
const Line& ln_l) ->
bool {
29 if (pt_p != pt_p)
return false;
30 if (pt_p.incident(ln_l) != ln_l.incident(pt_p))
return false;
31 if (pt_p.meet(pt_q) != pt_q.meet(pt_p))
return false;
32 const auto ln_m = pt_p.meet(pt_q);
33 if (!(ln_m.incident(pt_p) && ln_m.incident(pt_q)))
return false;
47 template <
class Po
int,
class Line =
typename Po
int::Dual>
48#if __cpp_concepts >= 201907L
49 requires ProjPlanePrimDual<Point, Line>
51 constexpr auto coincident(
const Point& pt_p,
const Point& pt_q,
const Point& pt_r) ->
bool {
52 return pt_p.meet(pt_q).incident(pt_r);
64 template <
class Po
int,
class Line =
typename Po
int::Dual>
65#if __cpp_concepts >= 201907L
66 requires ProjPlanePrimDual<Point, Line>
69 const std::array<Point, 3>& coline2) ->
bool {
70 const auto& [pt_a, pt_b, pt_c] = coline1;
71 const auto& [pt_d, pt_e, pt_f] = coline2;
72 const auto pt_g = (pt_a.meet(pt_e)).
meet(pt_b.meet(pt_d));
73 const auto pt_h = (pt_a.meet(pt_f)).
meet(pt_c.meet(pt_d));
74 const auto pt_i = (pt_b.meet(pt_f)).
meet(pt_c.meet(pt_e));
89 template <
class Po
int,
class Line =
typename Po
int::Dual>
90#if __cpp_concepts >= 201907L
91 requires ProjPlanePrimDual<Point, Line>
93 constexpr auto tri_dual(
const std::array<Point, 3>& triangle) -> std::array<Line, 3> {
94 const auto& [a_1, a_2, a_3] = triangle;
96 return {a_2.meet(a_3), a_1.meet(a_3), a_1.meet(a_2)};
108 template <
class Po
int,
class Line =
typename Po
int::Dual>
109#if __cpp_concepts >= 201907L
110 requires ProjPlanePrimDual<Point, Line>
112 constexpr auto persp(
const std::array<Point, 3>& tri1,
const std::array<Point, 3>& tri2)
114 const auto& [pt_a, pt_b, pt_c] = tri1;
115 const auto& [pt_d, pt_e, pt_f] = tri2;
116 const auto& o = pt_a.meet(pt_d).meet(pt_b.meet(pt_e));
117 return pt_c.meet(pt_f).incident(o);
129 template <
class Po
int,
class Line =
typename Po
int::Dual>
130#if __cpp_concepts >= 201907L
131 requires ProjPlanePrimDual<Point, Line>
134 const std::array<Point, 3>& tri2) ->
bool {
137 const auto bool1 =
persp(tri1, tri2);
138 const auto bool2 =
persp(trid1, trid2);
139 return (bool1 && bool2) || (!bool1 && !bool2);
154 template <
typename Value,
class Po
int,
class Line>
155#if __cpp_concepts >= 201907L
156 requires ProjectivePlaneDual<Value, Point, Line>
158 inline auto check_axiom2(
const Point& pt_p,
const Point& pt_q,
const Line& ln_l,
const Value& a,
159 const Value& b) ->
bool {
160 if (pt_p.dot(ln_l) != ln_l.dot(pt_p))
return false;
161 if (pt_p.aux().incident(pt_p))
return false;
162 const auto ln_m = pt_p.meet(pt_q);
163 if (!ln_m.incident(Point::parametrize(a, pt_p, b, pt_q)))
return false;
180 template <
typename Value,
class Po
int,
class Line =
typename Po
int::Dual>
181#if __cpp_concepts >= 201907L
182 requires ProjectivePlaneDual<Value, Point, Line>
184 constexpr auto harm_conj(
const Point& pt_a,
const Point& pt_b,
const Point& pt_c) -> Point {
186 const auto ab = pt_a.meet(pt_b);
187 const auto lc = ab.aux().meet(pt_c);
188 return Point::parametrize(lc.dot(pt_a), pt_a, lc.dot(pt_b), pt_b);
206 template <
typename Value,
class Po
int,
class Line>
207#if __cpp_concepts >= 201907L
208 requires ProjectivePlaneDual<Value, Point, Line>
210 constexpr auto involution(
const Point& origin,
const Line& mirror,
const Point& pt_p) -> Point {
211 const auto po = pt_p.meet(origin);
212 const auto pt_b = po.meet(mirror);
Definition ck_concepts.hpp:11
constexpr auto check_pappus(const std::array< Point, 3 > &coline1, const std::array< Point, 3 > &coline2) -> bool
Check Pappus Theorem.
Definition pg_plane.hpp:68
constexpr auto persp(const std::array< Point, 3 > &tri1, const std::array< Point, 3 > &tri2) -> bool
return whether two triangles are perspective
Definition pg_plane.hpp:112
constexpr auto tri_dual(const std::array< Point, 3 > &triangle) -> std::array< Line, 3 >
Dual of triangle.
Definition pg_plane.hpp:93
constexpr auto harm_conj(const Point &pt_a, const Point &pt_b, const Point &pt_c) -> Point
Harmonic conjugate.
Definition pg_plane.hpp:184
auto check_axiom(const Point &pt_p, const Point &pt_q, const Line &ln_l) -> bool
Check Projective plane Axiom.
Definition pg_plane.hpp:28
constexpr auto meet(const pg_line< _K > &ln_l, const pg_line< _K > &ln_m) -> pg_point< _K >
Definition pg_line.hpp:53
constexpr auto coincident(const Point &pt_p, const Point &pt_q, const Point &pt_r) -> bool
Coincident.
Definition pg_plane.hpp:51
constexpr auto check_desargue(const std::array< Point, 3 > &tri1, const std::array< Point, 3 > &tri2) -> bool
Check Desargue's Theorem.
Definition pg_plane.hpp:133
auto check_axiom2(const Point &pt_p, const Point &pt_q, const Line &ln_l, const Value &a, const Value &b) -> bool
Check Axiom 2 for extended projective plane properties.
Definition pg_plane.hpp:158
constexpr auto involution(const Point &origin, const Line &mirror, const Point &pt_p) -> Point
Involution on a point.
Definition pg_plane.hpp:210
C++20 concepts for projective plane primitives.