From ea2a650362a2a374eca941f99a03fcc49c79bf21 Mon Sep 17 00:00:00 2001 From: Wai-Shing Luk Date: Wed, 16 Aug 2023 22:33:01 +0800 Subject: [PATCH] spell out the variable names --- include/projgeom/euclid_plane.hpp | 8 ++++---- include/projgeom/persp_object.hpp | 2 +- include/projgeom/persp_plane.hpp | 4 ++-- include/projgeom/pg_concepts.hpp | 2 +- include/projgeom/pg_object.hpp | 6 +++--- include/projgeom/pg_plane.hpp | 4 ++-- include/projgeom/proj_plane.hpp | 6 +++--- include/projgeom/proj_plane_concepts.h | 2 +- test/source/test_concepts.tpp | 4 ++-- test/source/test_ell_plane.tpp | 4 ++-- test/source/test_euclid.tpp | 12 ++++++------ test/source/test_persp_plane.tpp | 10 +++++----- test/source/test_proj_plane.tpp | 8 ++++---- 13 files changed, 36 insertions(+), 36 deletions(-) diff --git a/include/projgeom/euclid_plane.hpp b/include/projgeom/euclid_plane.hpp index 80e5e1b..fbeb8d2 100644 --- a/include/projgeom/euclid_plane.hpp +++ b/include/projgeom/euclid_plane.hpp @@ -3,7 +3,7 @@ #include #include "pg_common.hpp" // import cross2, dot1 -#include "proj_plane.hpp" // import pg_point, Involution, tri_func, quad_func, plucker +#include "proj_plane.hpp" // import pg_point, Involution, tri_func, quad_func, parametrize #include "proj_plane_concepts.h" namespace fun { @@ -102,7 +102,7 @@ namespace fun { */ template constexpr auto midpoint(const Point &a, const Point &b) -> Point { - return plucker(b[2], a, a[2], b); + return parametrize(b[2], a, a[2], b); } /** @@ -140,7 +140,7 @@ namespace fun { * @param[in] c * @return auto */ - template constexpr auto Ar(const _Q &a, const _Q &b, const _Q &c) { + template constexpr auto archimede(const _Q &a, const _Q &b, const _Q &c) { return 4 * a * b - sq(a + b - c); } @@ -173,7 +173,7 @@ namespace fun { template constexpr auto Ptolemy(const T &quad) -> bool { const auto &[Q12, Q23, Q34, Q14, Q13, Q24] = quad; using _K = decltype(Q12); - return Ar(Q12 * Q34, Q23 * Q14, Q13 * Q24) == _K(0); + return archimede(Q12 * Q34, Q23 * Q14, Q13 * Q24) == _K(0); } } // namespace fun diff --git a/include/projgeom/persp_object.hpp b/include/projgeom/persp_object.hpp index 5423ade..446e2dd 100644 --- a/include/projgeom/persp_object.hpp +++ b/include/projgeom/persp_object.hpp @@ -72,5 +72,5 @@ constexpr auto PerspPoint::perp() const -> const PerspLine & { return L_INF; } * @return PerspPoint */ constexpr auto PerspLine::perp() const -> PerspPoint { - return PerspPoint::plucker(this->dot(I_RE), I_RE, this->dot(I_IM), I_IM); + return PerspPoint::parametrize(this->dot(I_RE), I_RE, this->dot(I_IM), I_IM); } diff --git a/include/projgeom/persp_plane.hpp b/include/projgeom/persp_plane.hpp index 52c043a..4b44deb 100644 --- a/include/projgeom/persp_plane.hpp +++ b/include/projgeom/persp_plane.hpp @@ -69,7 +69,7 @@ namespace fun { [[nodiscard]] constexpr auto perp(const Line &v) const -> Point { const auto alpha = v.dot(this->_Ire); const auto beta = v.dot(this->_Iim); - return plucker(alpha, this->_Ire, beta, this->_Iim); + return parametrize(alpha, this->_Ire, beta, this->_Iim); } /** @@ -95,7 +95,7 @@ namespace fun { [[nodiscard]] constexpr auto midpoint(const Point &pt_a, const Point &pt_b) const -> Point { const auto alpha = a.dot(this->_l_infty); const auto beta = pt_b.dot(this->_l_infty); - return plucker(alpha, pt_a, beta, pt_b); + return parametrize(alpha, pt_a, beta, pt_b); } /** diff --git a/include/projgeom/pg_concepts.hpp b/include/projgeom/pg_concepts.hpp index 7c3a098..9be0c72 100644 --- a/include/projgeom/pg_concepts.hpp +++ b/include/projgeom/pg_concepts.hpp @@ -43,7 +43,7 @@ namespace fun { && 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::plucker(a, pt_p, a, pt_q) } -> concepts::convertible_to; + { Point::parametrize(a, pt_p, a, pt_q) } -> concepts::convertible_to; }; /** diff --git a/include/projgeom/pg_object.hpp b/include/projgeom/pg_object.hpp index f606b5c..a1ece14 100644 --- a/include/projgeom/pg_object.hpp +++ b/include/projgeom/pg_object.hpp @@ -34,7 +34,7 @@ constexpr auto cross(const std::array &pt_a, const std::array struct PgObject { constexpr auto dot(const Line &other) const -> int64_t { return ::dot(this->coord, other.coord); } /** - * @brief + * @brief Homogeneous parametrization of point or line * * @param[in] lambda * @param[in] pt_p @@ -118,7 +118,7 @@ template struct PgObject { * @param[in] pt_q * @return Point */ - static constexpr auto plucker(const int64_t &lambda, const Point &pt_p, const int64_t &mu, + static constexpr auto parametrize(const int64_t &lambda, const Point &pt_p, const int64_t &mu, const Point &pt_q) -> Point { return Point{::plckr(lambda, pt_p.coord, mu, pt_q.coord)}; } diff --git a/include/projgeom/pg_plane.hpp b/include/projgeom/pg_plane.hpp index 1456e47..f820f72 100644 --- a/include/projgeom/pg_plane.hpp +++ b/include/projgeom/pg_plane.hpp @@ -160,7 +160,7 @@ namespace fun { 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); - if (!ln_m.incident(Point::plucker(a, pt_p, b, pt_q))) return false; + if (!ln_m.incident(Point::parametrize(a, pt_p, b, pt_q))) return false; return true; } @@ -182,7 +182,7 @@ namespace fun { assert(coincident(pt_a, pt_b, pt_c)); const auto ab = pt_a.meet(pt_b); const auto lc = ab.aux().meet(pt_c); - return Point::plucker(lc.dot(pt_a), pt_a, lc.dot(pt_b), pt_b); + return Point::parametrize(lc.dot(pt_a), pt_a, lc.dot(pt_b), pt_b); } /** diff --git a/include/projgeom/proj_plane.hpp b/include/projgeom/proj_plane.hpp index f657a21..db2b5a8 100644 --- a/include/projgeom/proj_plane.hpp +++ b/include/projgeom/proj_plane.hpp @@ -104,7 +104,7 @@ namespace fun { constexpr auto harm_conj(const Point &A, const Point &B, const Point &C) -> Point { assert(incident(A * B, C)); const auto lC = C * (A * B).aux(); - return plucker(B.dot(lC), A, A.dot(lC), B); + return parametrize(B.dot(lC), A, A.dot(lC), B); } /** @@ -176,7 +176,7 @@ namespace fun { * @return Point */ constexpr auto operator()(const Point &pt_p) const -> Point { - return plucker(this->_c, pt_p, K(-2 * pt_p.dot(this->_m)), this->_o); + return parametrize(this->_c, pt_p, K(-2 * pt_p.dot(this->_m)), this->_o); } /** @@ -186,7 +186,7 @@ namespace fun { * @return Point */ constexpr auto operator()(const Line &ln_l) const -> Line { - return plucker(this->_c, ln_l, K(-2 * ln_l.dot(this->_o)), this->_m); + return parametrize(this->_c, ln_l, K(-2 * ln_l.dot(this->_o)), this->_m); } }; diff --git a/include/projgeom/proj_plane_concepts.h b/include/projgeom/proj_plane_concepts.h index a40bba0..a18874b 100644 --- a/include/projgeom/proj_plane_concepts.h +++ b/include/projgeom/proj_plane_concepts.h @@ -110,7 +110,7 @@ namespace fun { pt_p.aux() } -> STD_ALT::convertible_to; // line not incident with pt_p { - plucker(pt_a, pt_p, pt_a, pt_q) + parametrize(pt_a, pt_p, pt_a, pt_q) } -> STD_ALT::convertible_to; // module computation }; diff --git a/test/source/test_concepts.tpp b/test/source/test_concepts.tpp index eaef54d..05b04b7 100644 --- a/test/source/test_concepts.tpp +++ b/test/source/test_concepts.tpp @@ -96,12 +96,12 @@ inline auto operator*(LA const & /*unused*/, LA const & /*unused*/) -> PA { } inline auto PA::aux() -> LA { return LA{}; } inline auto LA::aux() -> PA { return PA{}; } -inline auto plucker(const PA::value_type & /*unused*/, const PA & /*unused*/, +inline auto parametrize(const PA::value_type & /*unused*/, const PA & /*unused*/, const PA::value_type & /*unused*/, const PA & /*unused*/) -> PA { return PA{}; } -inline auto plucker(const LA::value_type & /*unused*/, const LA & /*unused*/, +inline auto parametrize(const LA::value_type & /*unused*/, const LA & /*unused*/, const LA::value_type & /*unused*/, const LA & /*unused*/) -> LA { return LA{}; diff --git a/test/source/test_ell_plane.tpp b/test/source/test_ell_plane.tpp index f87a24f..0bea88e 100644 --- a/test/source/test_ell_plane.tpp +++ b/test/source/test_ell_plane.tpp @@ -47,7 +47,7 @@ template void chk_tri(const PG &myck) { auto a1 = Point{1, 3, 1}; auto a2 = Point{4, 2, 1}; auto a3 = Point{1, 1, -1}; - auto a4 = plucker(2, a1, 3, a2); + auto a4 = parametrize(2, a1, 3, a2); const auto triangle = std::array{std::move(a1), std::move(a2), std::move(a3)}; const auto trilateral = tri_dual(triangle); @@ -85,7 +85,7 @@ template void chk_tri2(const PG &myck) { auto a1 = Point{1, 3, 1}; auto a2 = Point{4, 2, 1}; - auto a4 = plucker(2, a1, 3, a2); + auto a4 = parametrize(2, a1, 3, a2); const auto collin = std::array{std::move(a1), std::move(a2), std::move(a4)}; const auto Q2 = myck.tri_quadrance(collin); diff --git a/test/source/test_euclid.tpp b/test/source/test_euclid.tpp index aa2bc07..01dfae4 100644 --- a/test/source/test_euclid.tpp +++ b/test/source/test_euclid.tpp @@ -11,7 +11,7 @@ #include "projgeom/ck_plane.hpp" // for check_sine... #include "projgeom/common_concepts.h" // for Value_type -#include "projgeom/euclid_plane.hpp" // for uc_point, Ar +#include "projgeom/euclid_plane.hpp" // for uc_point, archimede #include "projgeom/euclid_plane_measure.hpp" // for quadrance #include "projgeom/fractions.hpp" // for operator* #include "projgeom/pg_common.hpp" // for sq, cross @@ -80,11 +80,11 @@ void chk_euclid(const Triple &triangle) { sq(s1 + s2 + s3) - 2 * (s1 * s1 + s2 * s2 + s3 * s3) - 4 * s1 * s2 * s3; auto c3 = sq(q1 + q2 - q3) / (4 * q1 * q2); - auto a3p = plucker(3, a1, 4, a2); + auto a3p = parametrize(3, a1, 4, a2); auto q1p = quadrance(a2, a3p); auto q2p = quadrance(a1, a3p); auto q3p = quadrance(a1, a2); - auto tqf2 = Ar(q1p, q2p, q3p); // get 0 + auto tqf2 = archimede(q1p, q2p, q3p); // get 0 if constexpr (Integral) { CHECK(!is_parallel(l1, l2)); @@ -103,7 +103,7 @@ void chk_euclid(const Triple &triangle) { CHECK(coincident(mt1 * mt2, mt3)); // CHECK(cross_s(l1, l2) == c3); CHECK((c3 + s3) == K(1)); - CHECK(tqf == Ar(q1, q2, q3)); + CHECK(tqf == archimede(q1, q2, q3)); CHECK(tsf == K(0)); CHECK(tqf2 == K(0)); // auto o2 = orthocenter( @@ -126,7 +126,7 @@ void chk_euclid(const Triple &triangle) { CHECK(distance(a1, a1) == Zero); // CHECK(cross_s(l1, l2) == doctest::Approx(c3).epsilon(0.01)); CHECK((c3 + s3) - 1 == Zero); - CHECK(tqf - Ar(q1, q2, q3) == Zero); + CHECK(tqf - archimede(q1, q2, q3) == Zero); CHECK(tsf == Zero); CHECK(tqf2 == Zero); // CHECK(ApproxEqual(a1, orthocenter(std::array{std::move(o), // not @@ -154,7 +154,7 @@ template void chk_cyclic(const T &quadangle) { std::move(q14), std::move(q24), std::move(q13)}); CHECK(okay); } else { - auto t = Ar(q12 * q34, q23 * q14, q13 * q24); + auto t = archimede(q12 * q34, q23 * q14, q13 * q24); CHECK(t == Zero); } } diff --git a/test/source/test_persp_plane.tpp b/test/source/test_persp_plane.tpp index e808640..fd01089 100644 --- a/test/source/test_persp_plane.tpp +++ b/test/source/test_persp_plane.tpp @@ -9,7 +9,7 @@ #include // for move #include "projgeom/common_concepts.h" // for Value_type -#include "projgeom/euclid_plane.hpp" // for Ar +#include "projgeom/euclid_plane.hpp" // for archimede #include "projgeom/fractions.hpp" // for operator* #include "projgeom/persp_plane.hpp" // for persp_eucl... #include "projgeom/pg_common.hpp" // for sq @@ -62,13 +62,13 @@ template void chk_degenerate(const PG &myck) { CHECK(!myck.is_parallel(l1, l2)); CHECK(!myck.is_parallel(l2, l3)); CHECK(coincident(t1 * t2, t3)); - CHECK(tqf == Ar(q1, q2, q3)); + CHECK(tqf == archimede(q1, q2, q3)); CHECK(tsf == K(0)); } else { CHECK(myck.l_infty().dot(l1 * l2) != Zero); CHECK(myck.l_infty().dot(l2 * l3) != Zero); CHECK(t1.dot(t2 * t3) == Zero); - CHECK(tqf - Ar(q1, q2, q3) == Zero); + CHECK(tqf - archimede(q1, q2, q3) == Zero); CHECK(tsf == Zero); } } @@ -86,11 +86,11 @@ template void chk_degenerate2(const PG &myck) { auto a1 = Point{-1, 0, 3}; auto a2 = Point{4, -2, 1}; - auto a4 = plucker(3, a1, 4, a2); + auto a4 = parametrize(3, a1, 4, a2); const auto tri2 = std::array{std::move(a1), std::move(a2), std::move(a4)}; const auto [qq1, qq2, qq3] = myck.tri_quadrance(tri2); - const auto tqf2 = Ar(qq1, qq2, qq3); // get 0 + const auto tqf2 = archimede(qq1, qq2, qq3); // get 0 if constexpr (Integral) { CHECK(tqf2 == 0); diff --git a/test/source/test_proj_plane.tpp b/test/source/test_proj_plane.tpp index 8906580..892759f 100644 --- a/test/source/test_proj_plane.tpp +++ b/test/source/test_proj_plane.tpp @@ -31,7 +31,7 @@ TEST_CASE("Projective Point") { CHECK(incident(ln_l, pt_p)); CHECK(incident(ln_l, pt_q)); - auto pq = plucker(2. + 1i, pt_p, 3. + 0i, pt_q); + auto pq = parametrize(2. + 1i, pt_p, 3. + 0i, pt_q); auto pt_h = harm_conj(pt_p, pt_q, pq); CHECK(incident(ln_l, pq)); CHECK(is_harmonic(pt_p, pt_q, pq, pt_h)); @@ -41,7 +41,7 @@ TEST_CASE("Projective Point") { // auto t = pg_point{2 + 0j, -2j, 2 + 0j}; // auto O = meet(join(pt_p, s), join(pt_q, t)); - // auto u = plucker(1 + 0j, O, -1 - 1j, pt_r); + // auto u = parametrize(1 + 0j, O, -1 - 1j, pt_r); // check_desargue(std::array{pt_p, pt_q, pt_r}, std::array{s, t, u}); } @@ -51,7 +51,7 @@ TEST_CASE("Projective Line") { auto ln_l = pg_line{1. - 2i, 3. - 1i, 2. + 1i}; // complex number auto ln_m = pg_line{-2. + 1i, 1. - 3i, -1. - 1i}; auto A = ln_l * ln_m; - auto lm = plucker(2. + 3i, ln_l, 3. - 4i, ln_m); + auto lm = parametrize(2. + 3i, ln_l, 3. - 4i, ln_m); // std::cout << A << '\ln_m'; @@ -68,7 +68,7 @@ TEST_CASE("Projective Line") { // ln_l]) // auto o = join(meet(ln_l, s), meet(ln_m, t)); - // auto u = plucker(1 + 0j, o, -1 - 1j, pt_r); + // auto u = parametrize(1 + 0j, o, -1 - 1j, pt_r); // check_desargue(std::array{ln_l, ln_m, pt_r}, std::array{s, t, u}); }