Skip to content

Commit

Permalink
spell out variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
luk036 committed Aug 15, 2023
1 parent e8c0701 commit 2ec09f9
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 151 deletions.
42 changes: 21 additions & 21 deletions include/projgeom/ck_concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,48 @@

namespace fun {
/**
* @brief C-K plane Concept
* @brief Cayley-Klein plane Concept
*
* @tparam Point Point
* @tparam L Line
* @tparam Line Line
*/
template <class Point, class L = typename Point::Dual>
template <class Point, class Line = typename Point::Dual>
concept CayleyKleinPlanePrimitive = //
ProjectivePlanePrimitive<Point, L> //
&& requires(const Point &p, const L &l) {
{ p.perp() } -> concepts::convertible_to<L>;
ProjectivePlanePrimitive<Point, Line> //
&& requires(const Point &p, const Line &l) {
{ p.perp() } -> concepts::convertible_to<Line>;
};

/**
* @brief C-K plane Concept (full)
* @brief Cayley-Klein plane Concept (full)
*
* @tparam Point Point
* @tparam L Line
* @tparam Line Line
*/
template <class Point, class L = typename Point::Dual>
concept CKPlanePrimDual
= CayleyKleinPlanePrimitive<Point, L> && CayleyKleinPlanePrimitive<L, Point>;
template <class Point, class Line = typename Point::Dual>
concept CayleyKleinPlanePrimitiveDual
= CayleyKleinPlanePrimitive<Point, Line> && CayleyKleinPlanePrimitive<Line, Point>;

/**
* @brief C-K plane Concept
* @brief Cayley-Klein plane Concept
*
* @tparam Point Point
* @tparam L Line
* @tparam Line Line
*/
template <class V, class Point, class L = typename Point::Dual>
template <class Value, class Point, class Line = typename Point::Dual>
concept CayleyKleinPlane = //
ProjectivePlane<V, Point, L> //
&& requires(const Point &p, const L &l) {
{ p.perp() } -> concepts::convertible_to<L>;
ProjectivePlane<Value, Point, Line> //
&& requires(const Point &p, const Line &l) {
{ p.perp() } -> concepts::convertible_to<Line>;
};

/**
* @brief C-K plane Concept (full)
* @brief Cayley-Klein plane Concept (full)
*
* @tparam Point Point
* @tparam L Line
* @tparam Line Line
*/
template <class V, class Point, class L = typename Point::Dual>
concept CKPlaneDual = CayleyKleinPlane<V, Point, L> && CayleyKleinPlane<V, L, Point>;
template <class Value, class Point, class Line = typename Point::Dual>
concept CayleyKleinPlaneDual = CayleyKleinPlane<Value, Point, Line> && CayleyKleinPlane<Value, Line, Point>;

} // namespace fun
40 changes: 20 additions & 20 deletions include/projgeom/ck_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,39 @@ namespace fun {
* @brief
*
* @tparam Point Point
* @tparam L Line
* @tparam Line Line
*/
template <class L, class Point = typename L::Dual>
template <class Line, class Point = typename Line::Dual>
#if __cpp_concepts >= 201907L
requires CKPlanePrimDual<L, Point>
requires CayleyKleinPlanePrimitiveDual<Line, Point>
#endif
constexpr auto is_perpendicular(const L &m1, const L &m2) -> bool {
constexpr auto is_perpendicular(const Line &m1, const Line &m2) -> bool {
return m1.perp().incident(m2);
}

/**
* @brief
*
* @tparam Point Point
* @tparam L Line
* @tparam Line Line
*/
template <class Point, class L>
template <class Point, class Line>
#if __cpp_concepts >= 201907L
requires CKPlanePrimDual<Point, L>
requires CayleyKleinPlanePrimitiveDual<Point, Line>
#endif
constexpr auto altitude(const Point &p, const L &m) -> L {
constexpr auto altitude(const Point &p, const Line &m) -> Line {
return m.perp().meet(p);
}

/**
* @brief
*
* @param[in] tri
* @return std::arrary<L, 3>
* @return std::arrary<Line, 3>
*/
template <class Point, class L = typename Point::Dual>
template <class Point, class Line = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires CKPlanePrimDual<Point, L>
requires CayleyKleinPlanePrimitiveDual<Point, Line>
#endif
constexpr auto orthocenter(const std::array<Point, 3> &tri) -> Point {
const auto &[a1, a2, a3] = tri;
Expand All @@ -58,13 +58,13 @@ namespace fun {
* @brief
*
* @param[in] tri
* @return std::arrary<L, 3>
* @return std::arrary<Line, 3>
*/
template <class Point, class L>
template <class Point, class Line>
#if __cpp_concepts >= 201907L
requires CKPlanePrimDual<Point, L>
requires CayleyKleinPlanePrimitiveDual<Point, Line>
#endif
constexpr auto tri_altitude(const std::array<Point, 3> &tri) -> std::array<L, 3> {
constexpr auto tri_altitude(const std::array<Point, 3> &tri) -> std::array<Line, 3> {
const auto [l1, l2, l3] = tri_dual(tri);
const auto &[a1, a2, a3] = tri;
assert(!coincident(a1, a2, a3));
Expand All @@ -74,17 +74,17 @@ namespace fun {
return {t1, t2, t3};
}

template <typename V, class Point, class L = typename Point::Dual>
template <typename Value, class Point, class Line = typename Point::Dual>
#if __cpp_concepts >= 201907L
requires CKPlaneDual<V, Point, L>
requires CayleyKleinPlaneDual<Value, Point, Line>
#endif
constexpr auto reflect(const L &mirror, const Point &p) -> Point {
constexpr auto reflect(const Line &mirror, const Point &p) -> Point {
return involution(mirror.perp(), mirror, p);
}

/*
axiom(Point p, Point q, Point r, L l) {
l == L{p, q} => I(p, l) and I(q, l);
axiom(Point p, Point q, Point r, Line l) {
l == Line{p, q} => I(p, l) and I(q, l);
}
*/

Expand Down
34 changes: 17 additions & 17 deletions include/projgeom/ell_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,62 @@
#include "ck_plane.hpp"
#include "pg_object.hpp"

class EllPoint;
class EllLine;
class EllipticPoint;
class EllipticLine;

/**
* @brief Elliptic Point
*
*/
class EllPoint : public PgObject<EllPoint, EllLine> {
class EllipticPoint : public PgObject<EllipticPoint, EllipticLine> {
public:
/**
* @brief Construct a new Ell Point object
* @brief Construct a new Elliptic Point object
*
* @param[in] coord Homogeneous coordinate
*/
constexpr explicit EllPoint(std::array<int64_t, 3> coord)
: PgObject<EllPoint, EllLine>{coord} {}
constexpr explicit EllipticPoint(std::array<int64_t, 3> coord)
: PgObject<EllipticPoint, EllipticLine>{coord} {}

/**
* @brief
*
* @return EllLine
* @return EllipticLine
*/
constexpr auto perp() const -> EllLine;
constexpr auto perp() const -> EllipticLine;
};

/**
* @brief Elliptic Line
*
*/
class EllLine : public PgObject<EllLine, EllPoint> {
class EllipticLine : public PgObject<EllipticLine, EllipticPoint> {
public:
/**
* @brief Construct a new Ell Line object
* @brief Construct a new Elliptic Line object
*
* @param[in] coord Homogeneous coordinate
*/
constexpr explicit EllLine(std::array<int64_t, 3> coord) : PgObject<EllLine, EllPoint>{coord} {}
constexpr explicit EllipticLine(std::array<int64_t, 3> coord) : PgObject<EllipticLine, EllipticPoint>{coord} {}

/**
* @brief
*
* @return EllPoint
* @return EllipticPoint
*/
constexpr auto perp() const -> EllPoint;
constexpr auto perp() const -> EllipticPoint;
};

/**
* @brief
*
* @return EllLine
* @return EllipticLine
*/
inline constexpr auto EllPoint::perp() const -> EllLine { return EllLine{this->coord}; }
inline constexpr auto EllipticPoint::perp() const -> EllipticLine { return EllipticLine{this->coord}; }

/**
* @brief
*
* @return EllPoint
* @return EllipticPoint
*/
inline constexpr auto EllLine::perp() const -> EllPoint { return EllPoint{this->coord}; }
inline constexpr auto EllipticLine::perp() const -> EllipticPoint { return EllipticPoint{this->coord}; }
38 changes: 19 additions & 19 deletions include/projgeom/hyp_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,66 +3,66 @@
#include "ck_plane.hpp"
#include "pg_object.hpp"

class HypPoint;
class HypLine;
class HyperbolicPoint;
class HyperbolicLine;

/**
* @brief Hyperbolic Point
*
*/
class HypPoint : public PgObject<HypPoint, HypLine> {
class HyperbolicPoint : public PgObject<HyperbolicPoint, HyperbolicLine> {
public:
/**
* @brief Construct a new Hyp Point object
* @brief Construct a new Hyperbolic Point object
*
* @param[in] coord Homogeneous coordinate
*/
constexpr explicit HypPoint(std::array<int64_t, 3> coord)
: PgObject<HypPoint, HypLine>{coord} {}
constexpr explicit HyperbolicPoint(std::array<int64_t, 3> coord)
: PgObject<HyperbolicPoint, HyperbolicLine>{coord} {}

/**
* @brief
*
* @return HypLine
* @return HyperbolicLine
*/
constexpr auto perp() const -> HypLine;
constexpr auto perp() const -> HyperbolicLine;
};

/**
* @brief Hyperbolic Line
*
*/
class HypLine : public PgObject<HypLine, HypPoint> {
class HyperbolicLine : public PgObject<HyperbolicLine, HyperbolicPoint> {
public:
/**
* @brief Construct a new Hyp Line object
* @brief Construct a new Hyperbolic Line object
*
* @param[in] coord Homogeneous coordinate
*/
constexpr explicit HypLine(std::array<int64_t, 3> coord) : PgObject<HypLine, HypPoint>{coord} {}
constexpr explicit HyperbolicLine(std::array<int64_t, 3> coord) : PgObject<HyperbolicLine, HyperbolicPoint>{coord} {}

/**
* @brief
*
* @return HypPoint
* @return HyperbolicPoint
*/
constexpr auto perp() const -> HypPoint;
constexpr auto perp() const -> HyperbolicPoint;
};

/**
* @brief
*
* @return HypLine
* @return HyperbolicLine
*/
inline constexpr auto HypPoint::perp() const -> HypLine {
return HypLine({this->coord[0], this->coord[1], -this->coord[2]});
inline constexpr auto HyperbolicPoint::perp() const -> HyperbolicLine {
return HyperbolicLine({this->coord[0], this->coord[1], -this->coord[2]});
}

/**
* @brief
*
* @return HypPoint
* @return HyperbolicPoint
*/
inline constexpr auto HypLine::perp() const -> HypPoint {
return HypPoint({this->coord[0], this->coord[1], -this->coord[2]});
inline constexpr auto HyperbolicLine::perp() const -> HyperbolicPoint {
return HyperbolicPoint({this->coord[0], this->coord[1], -this->coord[2]});
}
4 changes: 2 additions & 2 deletions include/projgeom/myck_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class MyCKPoint;
class MyCKLine;

/**
* @brief Some C-K Point
* @brief Some Cayley-Klein Point
*
*/
class MyCKPoint : public PgObject<MyCKPoint, MyCKLine> {
Expand All @@ -29,7 +29,7 @@ class MyCKPoint : public PgObject<MyCKPoint, MyCKLine> {
};

/**
* @brief Some C-K Line
* @brief Some Cayley-Klein Line
*
*/
class MyCKLine : public PgObject<MyCKLine, MyCKPoint> {
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 @@ -79,18 +79,18 @@ namespace fun {
* @brief generic Plucker function
*
* @tparam _K data type
* @param[in] ld lamda
* @param[in] lambda lamda
* @param[in] v
* @param[in] mu
* @param[in] w
* @return lamda*v + mu*w
*/
template <Ring _T, Ring _K> auto plucker_c(const _T &ld, const std::array<_K, 3> &v1,
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 auto &[x1, y1, z1] = v1;
const auto &[x2, y2, z2] = v2;
return {ld * x1 + mu * x2, ld * y1 + mu * y2, ld * z1 + mu * z2};
return {lambda * x1 + mu * x2, lambda * y1 + mu * y2, lambda * z1 + mu * z2};
}

/**
Expand Down
Loading

0 comments on commit 2ec09f9

Please sign in to comment.