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 15, 2023
1 parent 2ec09f9 commit 2f332a4
Show file tree
Hide file tree
Showing 15 changed files with 224 additions and 224 deletions.
8 changes: 4 additions & 4 deletions include/projgeom/ck_concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace fun {
template <class Point, class Line = typename Point::Dual>
concept CayleyKleinPlanePrimitive = //
ProjectivePlanePrimitive<Point, Line> //
&& requires(const Point &p, const Line &l) {
{ p.perp() } -> concepts::convertible_to<Line>;
&& requires(const Point &pt_p, const Line &ln_l) {
{ pt_p.perp() } -> concepts::convertible_to<Line>;
};

/**
Expand All @@ -37,8 +37,8 @@ namespace fun {
template <class Value, class Point, class Line = typename Point::Dual>
concept CayleyKleinPlane = //
ProjectivePlane<Value, Point, Line> //
&& requires(const Point &p, const Line &l) {
{ p.perp() } -> concepts::convertible_to<Line>;
&& requires(const Point &pt_p, const Line &ln_l) {
{ pt_p.perp() } -> concepts::convertible_to<Line>;
};

/**
Expand Down
12 changes: 6 additions & 6 deletions include/projgeom/ck_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ namespace fun {
#if __cpp_concepts >= 201907L
requires CayleyKleinPlanePrimitiveDual<Point, Line>
#endif
constexpr auto altitude(const Point &p, const Line &m) -> Line {
return m.perp().meet(p);
constexpr auto altitude(const Point &pt_p, const Line &ln_m) -> Line {
return ln_m.perp().meet(pt_p);
}

/**
Expand Down Expand Up @@ -78,13 +78,13 @@ namespace fun {
#if __cpp_concepts >= 201907L
requires CayleyKleinPlaneDual<Value, Point, Line>
#endif
constexpr auto reflect(const Line &mirror, const Point &p) -> Point {
return involution(mirror.perp(), mirror, p);
constexpr auto reflect(const Line &mirror, const Point &pt_p) -> Point {
return involution(mirror.perp(), mirror, pt_p);
}

/*
axiom(Point p, Point q, Point r, Line l) {
l == Line{p, q} => I(p, l) and I(q, l);
axiom(Point pt_p, Point pt_q, Point pt_r, Line ln_l) {
ln_l == Line{pt_p, pt_q} => I(pt_p, ln_l) and I(pt_q, ln_l);
}
*/

Expand Down
24 changes: 12 additions & 12 deletions include/projgeom/common_concepts.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ namespace fun {
};

template <typename K>
concept Ring = STD_ALT::equality_comparable<K> && requires(K a, K b) {
{ a + b } -> STD_ALT::convertible_to<K>;
{ a - b } -> STD_ALT::convertible_to<K>;
{ a *b } -> STD_ALT::convertible_to<K>;
{ a += b } -> STD_ALT::same_as<K &>;
{ a -= b } -> STD_ALT::same_as<K &>;
{ a *= b } -> STD_ALT::same_as<K &>;
concept Ring = STD_ALT::equality_comparable<K> && requires(K a, K pt_b) {
{ a + pt_b } -> STD_ALT::convertible_to<K>;
{ a - pt_b } -> STD_ALT::convertible_to<K>;
{ a *pt_b } -> STD_ALT::convertible_to<K>;
{ a += pt_b } -> STD_ALT::same_as<K &>;
{ a -= pt_b } -> STD_ALT::same_as<K &>;
{ a *= pt_b } -> STD_ALT::same_as<K &>;
{ -a } -> STD_ALT::convertible_to<K>;
{ K(a) } -> STD_ALT::convertible_to<K>;
{ K(0) } -> STD_ALT::convertible_to<K>;
Expand All @@ -45,11 +45,11 @@ namespace fun {
concept OrderedRing = Ring<K> && STD_ALT::totally_ordered<K>;

template <typename Z>
concept Integral = OrderedRing<Z> && requires(Z a, Z b) {
{ a % b } -> STD_ALT::convertible_to<Z>;
{ a / b } -> STD_ALT::convertible_to<Z>;
{ a %= b } -> STD_ALT::same_as<Z &>;
{ a /= b } -> STD_ALT::same_as<Z &>;
concept Integral = OrderedRing<Z> && requires(Z a, Z pt_b) {
{ a % pt_b } -> STD_ALT::convertible_to<Z>;
{ a / pt_b } -> STD_ALT::convertible_to<Z>;
{ a %= pt_b } -> STD_ALT::same_as<Z &>;
{ a /= pt_b } -> STD_ALT::same_as<Z &>;
};

} // namespace fun
18 changes: 9 additions & 9 deletions include/projgeom/persp_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,27 @@ namespace fun {
/**
* @brief
*
* @param[in] line_l
* @param[in] line_m
* @param[in] ln_l
* @param[in] ln_m
* @return true
* @return false
*/
[[nodiscard]] constexpr auto is_parallel(const Line &line_l, const Line &line_m) const
[[nodiscard]] constexpr auto is_parallel(const Line &ln_l, const Line &ln_m) const
-> bool {
return incident(this->_l_infty, line_l * line_m);
return incident(this->_l_infty, ln_l * ln_m);
}

/**
* @brief
*
* @param[in] a
* @param[in] b
* @param[in] pt_a
* @param[in] pt_b
* @return Point
*/
[[nodiscard]] constexpr auto midpoint(const Point &a, const Point &b) const -> Point {
[[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 = b.dot(this->_l_infty);
return plucker(alpha, a, beta, b);
const auto beta = pt_b.dot(this->_l_infty);
return plucker(alpha, pt_a, beta, pt_b);
}

/**
Expand Down
14 changes: 7 additions & 7 deletions include/projgeom/pg_concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ namespace fun {
template <class Point, class Line>
concept ProjectivePlanePrimitive = //
concepts::equality_comparable<Point> //
&& requires(const Point &p, const Point &q, const Line &l) {
{ p.incident(l) } -> concepts::convertible_to<bool>; // incidence
{ p.meet(q) } -> concepts::convertible_to<Line>; // join or meet
&& 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
};

/**
Expand All @@ -40,10 +40,10 @@ namespace fun {
template <typename Value, class Point, class Line>
concept ProjectivePlane
= concepts::equality_comparable<Point> && ProjectivePlanePrimitive<Point, Line> //
&& requires(const Point &p, const Point &q, const Line &l, const Value &a) {
{ p.aux() } -> concepts::convertible_to<Line>; // line not incident with p
{ p.dot(l) } -> concepts::convertible_to<Value>; // for basic measurement
{ Point::plucker(a, p, a, 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::plucker(a, pt_p, a, pt_q) } -> concepts::convertible_to<Point>;
};

/**
Expand Down
6 changes: 3 additions & 3 deletions include/projgeom/pg_line.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ namespace fun {
};

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

} // namespace fun
44 changes: 22 additions & 22 deletions include/projgeom/pg_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,45 @@
/**
* @brief Dot product
*
* @param[in] a
* @param[in] b
* @param[in] pt_a
* @param[in] pt_b
* @return int64_t
*/
constexpr auto dot(const std::array<int64_t, 3> &a, const std::array<int64_t, 3> &b) -> int64_t {
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
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];
}

/**
* @brief Cross product
*
* @param[in] a
* @param[in] b
* @param[in] pt_a
* @param[in] pt_b
* @return std::array<int64_t, 3>
*/
constexpr auto cross(const std::array<int64_t, 3> &a, const std::array<int64_t, 3> &b)
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 {
a[1] * b[2] - a[2] * b[1],
a[2] * b[0] - a[0] * b[2],
a[0] * b[1] - a[1] * b[0],
pt_a[1] * pt_b[2] - pt_a[2] * pt_b[1],
pt_a[2] * pt_b[0] - pt_a[0] * pt_b[2],
pt_a[0] * pt_b[1] - pt_a[1] * pt_b[0],
};
}

/**
* @brief Plucker operation
*
* @param[in] lambda
* @param[in] p
* @param[in] pt_p
* @param[in] mu
* @param[in] q
* @param[in] pt_q
* @return std::array<int64_t, 3>
*/
constexpr auto plckr(const int64_t &lambda, const std::array<int64_t, 3> &p, const int64_t &mu,
const std::array<int64_t, 3> &q) -> std::array<int64_t, 3> {
constexpr auto plckr(const int64_t &lambda, const std::array<int64_t, 3> &pt_p, const int64_t &mu,
const std::array<int64_t, 3> &pt_q) -> std::array<int64_t, 3> {
return {
lambda * p[0] + mu * q[0],
lambda * p[1] + mu * q[1],
lambda * p[2] + mu * q[2],
lambda * pt_p[0] + mu * pt_q[0],
lambda * pt_p[1] + mu * pt_q[1],
lambda * pt_p[2] + mu * pt_q[2],
};
}

Expand Down Expand Up @@ -113,14 +113,14 @@ template <typename Point, typename Line> struct PgObject {
* @brief
*
* @param[in] lambda
* @param[in] p
* @param[in] pt_p
* @param[in] mu
* @param[in] q
* @param[in] pt_q
* @return Point
*/
static constexpr auto plucker(const int64_t &lambda, const Point &p, const int64_t &mu,
const Point &q) -> Point {
return Point{::plckr(lambda, p.coord, mu, q.coord)};
static constexpr auto plucker(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
Loading

0 comments on commit 2f332a4

Please sign in to comment.