Skip to content

Commit

Permalink
spell out the variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
luk036 committed Aug 16, 2023
1 parent 2f332a4 commit ea2a650
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 36 deletions.
8 changes: 4 additions & 4 deletions include/projgeom/euclid_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <type_traits>

#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 {
Expand Down Expand Up @@ -102,7 +102,7 @@ namespace fun {
*/
template <ProjectivePlaneCoord2 Point> 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);
}

/**
Expand Down Expand Up @@ -140,7 +140,7 @@ namespace fun {
* @param[in] c
* @return auto
*/
template <OrderedRing _Q> constexpr auto Ar(const _Q &a, const _Q &b, const _Q &c) {
template <OrderedRing _Q> constexpr auto archimede(const _Q &a, const _Q &b, const _Q &c) {
return 4 * a * b - sq(a + b - c);
}

Expand Down Expand Up @@ -173,7 +173,7 @@ namespace fun {
template <typename T> 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
2 changes: 1 addition & 1 deletion include/projgeom/persp_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions include/projgeom/persp_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion include/projgeom/pg_concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>; // line not incident with pt_p
{ pt_p.dot(ln_l) } -> concepts::convertible_to<Value>; // for basic measurement
{ Point::plucker(a, pt_p, a, pt_q) } -> concepts::convertible_to<Point>;
{ Point::parametrize(a, pt_p, a, pt_q) } -> concepts::convertible_to<Point>;
};

/**
Expand Down
6 changes: 3 additions & 3 deletions include/projgeom/pg_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ constexpr auto cross(const std::array<int64_t, 3> &pt_a, const std::array<int64_
}

/**
* @brief Plucker operation
* @brief Homogeneous parametrization of point or line
*
* @param[in] lambda
* @param[in] pt_p
Expand Down Expand Up @@ -110,15 +110,15 @@ template <typename Point, typename Line> 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
* @param[in] mu
* @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)};
}
Expand Down
4 changes: 2 additions & 2 deletions include/projgeom/pg_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions include/projgeom/proj_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand All @@ -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);
}
};

Expand Down
2 changes: 1 addition & 1 deletion include/projgeom/proj_plane_concepts.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ namespace fun {
pt_p.aux()
} -> STD_ALT::convertible_to<Line>; // 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<Point>; // module computation
};

Expand Down
4 changes: 2 additions & 2 deletions test/source/test_concepts.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -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{};
Expand Down
4 changes: 2 additions & 2 deletions test/source/test_ell_plane.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ template <typename PG> 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);
Expand Down Expand Up @@ -85,7 +85,7 @@ template <typename PG> 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);
Expand Down
12 changes: 6 additions & 6 deletions test/source/test_euclid.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -80,11 +80,11 @@ void chk_euclid(const Triple<Point> &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<K>) {
CHECK(!is_parallel(l1, l2));
Expand All @@ -103,7 +103,7 @@ void chk_euclid(const Triple<Point> &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(
Expand All @@ -126,7 +126,7 @@ void chk_euclid(const Triple<Point> &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
Expand Down Expand Up @@ -154,7 +154,7 @@ template <typename T> 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);
}
}
Expand Down
10 changes: 5 additions & 5 deletions test/source/test_persp_plane.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <type_traits> // 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
Expand Down Expand Up @@ -62,13 +62,13 @@ template <typename PG> 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);
}
}
Expand All @@ -86,11 +86,11 @@ template <typename PG> 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<K>) {
CHECK(tqf2 == 0);
Expand Down
8 changes: 4 additions & 4 deletions test/source/test_proj_plane.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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});
}

Expand All @@ -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';

Expand All @@ -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});
}

Expand Down

0 comments on commit ea2a650

Please sign in to comment.