ProjGeom 1.0.11
Loading...
Searching...
No Matches
Classes | Concepts | Typedefs | Enumerations | Functions
fun Namespace Reference

Classes

class  Conic
 A conic section represented by a symmetric 3x3 matrix. More...
 
struct  Fraction
 Fraction. More...
 
class  Involution
 
class  involution_generic
 Generic involution class for projective planes. More...
 
class  persp_euclid_plane
 Perspective-Euclidean plane class. More...
 
struct  pg_line
 Projective line: two dimensional subspace of K^3. More...
 
struct  pg_object
 Generic projective geometry object (value-type templated) More...
 
struct  pg_point
 

Concepts

concept  CayleyKleinPlanePrimitive
 Cayley-Klein plane Concept.
 
concept  CayleyKleinPlanePrimitiveDual
 Cayley-Klein plane Concept (full)
 
concept  CayleyKleinPlane
 Cayley-Klein plane Concept.
 
concept  CayleyKleinPlaneDual
 Cayley-Klein plane Concept (full)
 
concept  Sequence
 Sequence.
 
concept  Ring
 Ring concept.
 
concept  OrderedRing
 Ordered ring concept.
 
concept  Integral
 Integral concept.
 
concept  ProjectivePlanePrimitive
 Projective plane Concept.
 
concept  ProjPlanePrimDual
 Projective plane Concept (full)
 
concept  ProjectivePlane
 Projective plane Concept.
 
concept  ProjectivePlaneDual
 Projective plane dual Concept.
 
concept  ProjectivePlanePrimH
 Projective plane Concept (half)
 
concept  ProjectivePlanePrim
 Projective plane Concept (full)
 
concept  ProjectivePlanePrim2
 Shorthand Notation of ProjectivePlane.
 
concept  ProjectivePlaneGenericH
 Projective plane Concept (full)
 
concept  ProjectivePlaneGeneric
 Projective plane Concept (full)
 
concept  ProjectivePlaneGeneric2
 Shorthand Notation of ProjectivePlane.
 
concept  ProjectivePlaneH
 Projective plane Concept (half)
 
concept  ProjectivePlane2
 Shorthand Notation of ProjectivePlane.
 
concept  ProjectivePlaneCoordH
 Projective plane Concept (half)
 
concept  ProjectivePlaneCoord
 Projective plane Concept (full)
 
concept  ProjectivePlaneCoord2
 Shorthand Notation of ProjectivePlane.
 

Typedefs

template<typename T >
using Value_type = typename T::value_type
 Value type of a type.
 
template<typename T >
using Element_type = typename std::decay< decltype(back(std::declval< T >()))>::type
 Element type of a sequence.
 
template<typename Point >
using Triple = std::array< Point, 3 >
 Type alias for an array of three points (a triangle)
 

Enumerations

enum class  ConicType { Ellipse , Parabola , Hyperbola }
 Enumeration of conic types based on the discriminant. More...
 

Functions

template<class Line , class Point = typename Line::Dual>
constexpr auto is_perpendicular (const Line &l_1, const Line &l_2) -> bool
 Check if two lines are perpendicular (Cayley-Klein).
 
template<class Point , class Line >
constexpr auto altitude (const Point &pt_p, const Line &ln_m) -> Line
 Compute the altitude from a point to a line (Cayley-Klein).
 
template<class Point , class Line = typename Point::Dual>
constexpr auto orthocenter (const std::array< Point, 3 > &triangle) -> Point
 Compute the orthocenter of a triangle (Cayley-Klein).
 
template<class Point , class Line >
constexpr auto tri_altitude (const std::array< Point, 3 > &triangle) -> std::array< Line, 3 >
 Compute all three altitudes of a triangle (Cayley-Klein).
 
template<typename Value , class Point , class Line = typename Point::Dual>
constexpr auto reflect (const Line &mirror, const Point &pt_p) -> Point
 Reflect a point across a line (Cayley-Klein).
 
template<ProjectivePlaneCoord2 Line>
constexpr auto fB (const Line &line_l) -> typename Line::Dual
 Convert a line to its direction vector in the affine plane.
 
template<ProjectivePlaneCoord2 Line>
constexpr auto is_perpendicular (const Line &line_l, const Line &line_m) -> bool
 Check if two lines are perpendicular.
 
template<ProjectivePlaneCoord2 Line>
constexpr auto is_parallel (const Line &line_l, const Line &line_m) -> bool
 Check if two lines are parallel.
 
template<typename Point , typename Line >
requires ProjectivePlaneCoord<Point, Line>
constexpr auto altitude (const Point &a, const Line &line_l) -> Line
 Compute the altitude from a point to a line.
 
template<ProjectivePlaneCoord2 Point>
constexpr auto tri_altitude (const Triple< Point > &triangle)
 Compute all three altitudes of a triangle.
 
template<ProjectivePlaneCoord2 Point>
constexpr auto orthocenter (const Triple< Point > &triangle) -> Point
 Compute the orthocenter of a triangle.
 
template<ProjectivePlaneCoord2 Line>
constexpr auto reflect (const Line &line_m)
 Create an involution that reflects across a line.
 
template<ProjectivePlaneCoord2 Point>
constexpr auto midpoint (const Point &a, const Point &b) -> Point
 Compute the midpoint of two points.
 
template<ProjectivePlaneCoord2 Point>
constexpr auto tri_midpoint (const Triple< Point > &triangle) -> Triple< Point >
 Compute the midpoints of all three sides of a triangle.
 
template<ProjectivePlaneCoord2 Point>
constexpr auto uc_point (const Value_type< Point > &lda1, const Value_type< Point > &mu1)
 Compute a point on the unit circle from trigonometric parameters.
 
template<OrderedRing _Q>
constexpr auto archimedes (const _Q &a, const _Q &b, const _Q &c)
 Archimedes's function.
 
template<typename _Q >
constexpr auto cqq (const _Q &a, const _Q &b, const _Q &c, const _Q &d) -> std::array< _Q, 2 >
 Cyclic quadrilateral quadrea theorem.
 
template<typename T >
constexpr auto Ptolemy (const T &quad) -> bool
 Check Ptolemy's theorem for a cyclic quadrilateral.
 
template<typename K >
requires Integral<K>
constexpr auto quad1 (const K &x1, const K &z1, const K &x2, const K &z2)
 Compute squared difference of ratios (integral version).
 
template<typename K >
constexpr auto quad1 (const K &x1, const K &z1, const K &x2, const K &z2)
 Compute squared difference of ratios (non-integral version).
 
template<ProjectivePlaneCoord2 Point>
constexpr auto quadrance (const Point &a1, const Point &a2)
 Compute the quadrance between two points.
 
template<typename... Args>
constexpr auto quadrance_copy (const Args &... args)
 Compute quadrances for multiple pairs of points.
 
template<ProjectivePlaneCoord2 Line, typename T >
constexpr auto sbase (const Line &l1, const Line &l2, const T &d)
 Base function for spread and cross-spread.
 
template<ProjectivePlaneCoord2 Line>
constexpr auto spread (const Line &l1, const Line &l2)
 Compute the spread between two lines.
 
template<ProjectivePlaneCoord2 Point>
constexpr auto tri_quadrance (const Triple< Point > &triangle)
 Compute the quadrances of a triangle's sides.
 
template<ProjectivePlaneCoord2 Line>
constexpr auto tri_spread (const Triple< Line > &trilateral)
 Compute the spreads of a triangle's angles.
 
template<ProjectivePlaneCoord2 Line>
constexpr auto cross_s (const Line &l1, const Line &l2)
 Compute the cross spread between two lines.
 
template<typename T >
constexpr auto abs (const T &a) -> T
 absolute
 
template<Integral Mn>
constexpr auto gcd_recur (const Mn &_m, const Mn &_n) -> Mn
 Greatest common divider.
 
template<Integral Mn>
constexpr auto gcd (const Mn &_m, const Mn &_n) -> Mn
 Greatest common divisor.
 
template<Integral Mn>
constexpr auto lcm (const Mn &_m, const Mn &_n) -> Mn
 Least common multiple.
 
template<Ring _K>
auto cross0 (const std::array< _K, 3 > &v_a, const std::array< _K, 3 > &v_b) -> _K
 1st term of Cross product (yz-plane projection)
 
template<Ring _K>
auto cross1 (const std::array< _K, 3 > &v_a, const std::array< _K, 3 > &v_b) -> _K
 2nd term of Cross product (xz-plane projection)
 
template<Ring _K>
auto cross2 (const std::array< _K, 3 > &v_a, const std::array< _K, 3 > &v_b) -> _K
 3rd term of Cross product (xy-plane projection)
 
template<typename Point >
requires Ring<Value_type<Point>>
auto cross (const Point &v_a, const Point &v_b) -> std::array< Value_type< Point >, 3 >
 Cross product in homogeneous 3D coordinates.
 
template<Ring _K>
auto dot_c (const std::array< _K, 3 > &v_a, const std::array< _K, 3 > &v_b) -> _K
 Dot product (full 3-component)
 
template<Ring _T, Ring _K>
auto plucker_c (const _T &lambda_val, const std::array< _K, 3 > &v_a, const _T &mu_val, const std::array< _K, 3 > &v_b) -> std::array< _K, 3 >
 generic Plücker linear combination
 
template<Ring _K>
auto dot1 (const std::array< _K, 3 > &v_a, const std::array< _K, 3 > &v_b) -> _K
 Dot product of the (x,y)-components of two vectors (affine part)
 
template<Ring _K>
auto dot2 (const std::array< _K, 3 > &v_a, const std::array< _K, 3 > &v_b) -> _K
 Dot product of the (0,2)-component of two vectors.
 
template<typename T >
constexpr auto sq (const T &a)
 Square function.
 
template<typename Value , typename Point >
requires Ring<Value>
constexpr auto parametrize (const Value &lambda_val, const Point &pt_p, const Value &mu_val, const Point &pt_q) -> Point
 Homogeneous parametrization of point or line (free function)
 
template<Ring _K>
constexpr auto meet (const pg_line< _K > &ln_l, const pg_line< _K > &ln_m) -> pg_point< _K >
 
template<class Point , class Line >
auto check_axiom (const Point &pt_p, const Point &pt_q, const Line &ln_l) -> bool
 Check Projective plane Axiom.
 
template<class Point , class Line = typename Point::Dual>
constexpr auto coincident (const Point &pt_p, const Point &pt_q, const Point &pt_r) -> bool
 Coincident.
 
template<class Point , class Line = typename Point::Dual>
constexpr auto check_pappus (const std::array< Point, 3 > &coline1, const std::array< Point, 3 > &coline2) -> bool
 Check Pappus Theorem.
 
template<class Point , class Line = typename Point::Dual>
constexpr auto tri_dual (const std::array< Point, 3 > &triangle) -> std::array< Line, 3 >
 Dual of triangle.
 
template<class Point , class Line = typename Point::Dual>
constexpr auto persp (const std::array< Point, 3 > &tri1, const std::array< Point, 3 > &tri2) -> bool
 return whether two triangles are perspective
 
template<class Point , class Line = typename Point::Dual>
constexpr auto check_desargue (const std::array< Point, 3 > &tri1, const std::array< Point, 3 > &tri2) -> bool
 Check Desargue's Theorem.
 
template<typename Value , class Point , class Line >
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.
 
template<typename Value , class Point , class Line = typename Point::Dual>
constexpr auto harm_conj (const Point &pt_a, const Point &pt_b, const Point &pt_c) -> Point
 Harmonic conjugate.
 
template<typename Value , class Point , class Line >
constexpr auto involution (const Point &origin, const Line &mirror, const Point &pt_p) -> Point
 Involution on a point.
 
template<Ring _K>
constexpr auto join (const pg_point< _K > &pt_p, const pg_point< _K > &pt_q) -> pg_line< _K >
 Return the join (product) of two points to form a line.
 
template<typename Point , typename Line >
requires ProjectivePlane<Point, Line>
constexpr auto incident (const Point &pt_p, const Line &ln_l) -> bool
 The code snippet is defining a function named incident that checks if a point pt_p is incident to a line ln_l in a projective plane. The function uses the dot method of the Point class and compares it to zero to determine if the point is incident to the line. The function returns a boolean value indicating whether the point is incident to the line or not.
 
template<typename Line , typename... Args>
requires (ProjectivePlanePrim<Line, Args> && ...)
constexpr auto coincident (const Line &ln_l, const Args &... pt_r) -> bool
 Coincident.
 
template<ProjectivePlanePrim2 Point>
constexpr auto tri_dual (const Triple< Point > &triangle)
 Compute the dual triangle (sides as points).
 
template<ProjectivePlanePrim2 Point, typename Fn >
constexpr auto tri_func (Fn &&func, const Triple< Point > &triangle)
 Apply a binary function to all pairs of triangle vertices.
 
template<ProjectivePlanePrim2 Point>
constexpr auto persp (const Triple< Point > &tri1, const Triple< Point > &tri2) -> bool
 return whether two triangles are perspective
 
template<ProjectivePlane2 Point>
constexpr auto harm_conj (const Point &A, const Point &B, const Point &C) -> Point
 Compute the harmonic conjugate of three collinear points.
 
template<ProjectivePlaneGeneric2 _Point>
constexpr auto harm_conj (const _Point &A, const _Point &B, const _Point &C) -> _Point
 Compute the harmonic conjugate (generic version).
 
template<ProjectivePlane2 Point>
constexpr auto is_harmonic (const Point &A, const Point &B, const Point &C, const Point &D) -> bool
 Check if four points form a harmonic range.
 
template<ProjectivePlanePrim2 Point>
void check_pappus (const Triple< Point > &coline1, const Triple< Point > &coline2)
 Check Pappus Theorem for two sets of collinear points.
 
template<ProjectivePlanePrim2 Point>
void check_desargue (const Triple< Point > &tri1, const Triple< Point > &tri2)
 Check Desargues' theorem for two triangles.
 
template<Ring K>
constexpr auto ratio_ratio (const K &a, const K &b, const K &c, const K &d)
 Compute the ratio of two ratios.
 
template<typename Point , typename Line >
requires ProjectivePlane<Point, Line>
constexpr auto x_ratio (const Point &A, const Point &B, const Line &line_l, const Line &line_m)
 Cross Ratio.
 
template<ProjectivePlaneCoord2 Point>
constexpr auto R (const Point &A, const Point &B, const Point &C, const Point &D)
 Compute the cross ratio of four collinear points.
 
template<ProjectivePlaneCoord2 Point>
constexpr auto R0 (const Point &A, const Point &B, const Point &C, const Point &D)
 Compute cross ratio using yz-plane projection.
 
template<ProjectivePlaneCoord2 Point>
constexpr auto R1 (const Point &A, const Point &B, const Point &C, const Point &D)
 Compute cross ratio using xz-plane projection.
 

Detailed Description

Todo:
: projectivity >=
Todo:
: projectivity >=
Todo:
: projectivity >=

Typedef Documentation

◆ Element_type

template<typename T >
using fun::Element_type = typedef typename std::decay<decltype(back(std::declval<T>()))>::type

Element type of a sequence.

Extracts the element type from a sequence container by examining the type returned by the back() method.

Template Parameters
TA sequence type supporting back()

◆ Triple

template<typename Point >
using fun::Triple = typedef std::array<Point, 3>

Type alias for an array of three points (a triangle)

Template Parameters
PointThe point type

◆ Value_type

template<typename T >
using fun::Value_type = typedef typename T::value_type

Value type of a type.

Extracts the value_type member type from a type if it exists.

Template Parameters
TA type with a value_type member

Enumeration Type Documentation

◆ ConicType

enum class fun::ConicType
strong

Enumeration of conic types based on the discriminant.

Enumerator
Ellipse 
Parabola 
Hyperbola 

Function Documentation

◆ abs()

template<typename T >
constexpr auto fun::abs ( const T &  a) -> T
constexpr

absolute

Template Parameters
T
Parameters
[in]a
Returns
T

◆ altitude() [1/2]

template<typename Point , typename Line >
requires ProjectivePlaneCoord<Point, Line>
constexpr auto fun::altitude ( const Point &  a,
const Line &  line_l 
) -> Line
constexpr

Compute the altitude from a point to a line.

The altitude is the line through the given point that is perpendicular to the given line.

\[ h_a = a \times \bar{l} \]

where \(\bar{l}\) is the direction vector of line \(l\).

Parameters
[in]aThe point from which the altitude is drawn
[in]line_lThe line to which the altitude is drawn
Returns
Line The altitude line

◆ altitude() [2/2]

template<class Point , class Line >
constexpr auto fun::altitude ( const Point &  pt_p,
const Line &  ln_m 
) -> Line
constexpr

Compute the altitude from a point to a line (Cayley-Klein).

Uses the pole-polar relationship to compute the altitude.

Template Parameters
PointThe point type

\[ h = m^\perp \times p \]

where \(m^\perp\) is the polar of the line.
PointThe point type
LineThe line type

◆ archimedes()

template<OrderedRing _Q>
constexpr auto fun::archimedes ( const _Q &  a,
const _Q &  b,
const _Q &  c 
)
constexpr

Archimedes's function.

\[ \mathrm{archimedes}(a,b,c) = 4ab - (a + b - c)^2 \]

Template Parameters
_Q
Parameters
[in]a
[in]b
[in]c
Returns
auto

◆ check_axiom()

template<class Point , class Line >
auto fun::check_axiom ( const Point &  pt_p,
const Point &  pt_q,
const Line &  ln_l 
) -> bool
inline

Check Projective plane Axiom.

Template Parameters
PointPoint
LineLine
Parameters
[in]pt_p
[in]pt_q
[in]ln_l

◆ check_axiom2()

template<typename Value , class Point , class Line >
auto fun::check_axiom2 ( const Point &  pt_p,
const Point &  pt_q,
const Line &  ln_l,
const Value &  a,
const Value &  b 
) -> bool
inline

Check Axiom 2 for extended projective plane properties.

Template Parameters
ValueThe value/coordinate type
PointThe point type
LineThe line type (dual of point)
Parameters
[in]pt_pFirst point
[in]pt_qSecond point
[in]ln_lA line
[in]aFirst parameter value
[in]bSecond parameter value

◆ check_desargue() [1/2]

template<class Point , class Line = typename Point::Dual>
constexpr auto fun::check_desargue ( const std::array< Point, 3 > &  tri1,
const std::array< Point, 3 > &  tri2 
) -> bool
constexpr

Check Desargue's Theorem.

Template Parameters
PointPoint
Parameters
[in]tri1
[in]tri2
Returns
true
false

◆ check_desargue() [2/2]

template<ProjectivePlanePrim2 Point>
void fun::check_desargue ( const Triple< Point > &  tri1,
const Triple< Point > &  tri2 
)

Check Desargues' theorem for two triangles.

Asserts that two triangles are perspective from a point if and only if they are perspective from a line. This is a fundamental theorem in projective geometry.

Parameters
[in]tri1First triangle
[in]tri2Second triangle

◆ check_pappus() [1/2]

template<class Point , class Line = typename Point::Dual>
constexpr auto fun::check_pappus ( const std::array< Point, 3 > &  coline1,
const std::array< Point, 3 > &  coline2 
) -> bool
constexpr

Check Pappus Theorem.

Template Parameters
PointPoint
Parameters
[in]coline1
[in]coline2
Returns
true
false

◆ check_pappus() [2/2]

template<ProjectivePlanePrim2 Point>
void fun::check_pappus ( const Triple< Point > &  coline1,
const Triple< Point > &  coline2 
)

Check Pappus Theorem for two sets of collinear points.

Asserts that the three intersection points formed by joining corresponding points from two collinear triples are themselves collinear.

Parameters
[in]coline1First triple of collinear points
[in]coline2Second triple of collinear points

◆ coincident() [1/2]

template<typename Line , typename... Args>
requires (ProjectivePlanePrim<Line, Args> && ...)
constexpr auto fun::coincident ( const Line &  ln_l,
const Args &...  pt_r 
) -> bool
constexpr

Coincident.

Template Parameters
LineLine
Argspoints
Returns
true if points are conincident (on a line ln_l)
false otherwise

◆ coincident() [2/2]

template<class Point , class Line = typename Point::Dual>
constexpr auto fun::coincident ( const Point &  pt_p,
const Point &  pt_q,
const Point &  pt_r 
) -> bool
constexpr

Coincident.

Template Parameters
Point
Parameters
[in]pt_p
[in]pt_q
[in]pt_r
Returns
true
false

◆ cqq()

template<typename _Q >
constexpr auto fun::cqq ( const _Q &  a,
const _Q &  b,
const _Q &  c,
const _Q &  d 
) -> std::array<_Q, 2>
constexpr

Cyclic quadrilateral quadrea theorem.

Returns the coefficients of the quadratic equation whose roots are the quadrea of a cyclic quadrilateral with opposite sides (a,b) and (c,d).

\[ Q^2 - (4ab + 4cd - (a+b-c-d)^2)\,Q + 16abcd = 0 \]

Template Parameters
_Q
Parameters
[in]a
[in]b
[in]c
[in]d
Returns
auto

◆ cross()

template<typename Point >
requires Ring<Value_type<Point>>
auto fun::cross ( const Point &  v_a,
const Point &  v_b 
) -> std::array<Value_type<Point>, 3>

Cross product in homogeneous 3D coordinates.

\[ v_a \times v_b = \begin{pmatrix} v_{a,y} v_{b,z} - v_{b,y} v_{a,z} \\ v_{b,x} v_{a,z} - v_{a,x} v_{b,z} \\ v_{a,x} v_{b,y} - v_{b,x} v_{a,y} \end{pmatrix} \]

Template Parameters
_K
Parameters
[in]v_a
[in]v_b
Returns
Cross product

◆ cross0()

template<Ring _K>
auto fun::cross0 ( const std::array< _K, 3 > &  v_a,
const std::array< _K, 3 > &  v_b 
) -> _K

1st term of Cross product (yz-plane projection)

\[ \mathrm{cross}_0(v,w) = v_y w_z - w_y v_z \]

Template Parameters
_K
Parameters
[in]v
[in]w
Returns
1st term of Cross product

◆ cross1()

template<Ring _K>
auto fun::cross1 ( const std::array< _K, 3 > &  v_a,
const std::array< _K, 3 > &  v_b 
) -> _K

2nd term of Cross product (xz-plane projection)

\[ \mathrm{cross}_1(v_a,v_b) = v_{a,x} v_{b,z} - v_{b,x} v_{a,z} \]

Template Parameters
_K
Parameters
[in]v_a
[in]v_b
Returns
2nd term of Cross product

◆ cross2()

template<Ring _K>
auto fun::cross2 ( const std::array< _K, 3 > &  v_a,
const std::array< _K, 3 > &  v_b 
) -> _K

3rd term of Cross product (xy-plane projection)

\[ \mathrm{cross}_2(v_a,v_b) = v_{a,x} v_{b,y} - v_{b,x} v_{a,y} \]

Template Parameters
_K
Parameters
[in]v_a
[in]v_b
Returns
3rd term of Cross product

◆ cross_s()

template<ProjectivePlaneCoord2 Line>
constexpr auto fun::cross_s ( const Line &  l1,
const Line &  l2 
)
constexpr

Compute the cross spread between two lines.

The cross spread is the squared cosine of the angle between lines:

\[ \mathrm{cross\_s}(l_1, l_2) = \frac{\mathrm{dot}_1(l_1, l_2)^2} {\mathrm{dot}_1(l_1, l_1) \mathrm{dot}_1(l_2, l_2)} \]

Parameters
[in]l1First line
[in]l2Second line
Returns
auto The cross spread

◆ dot1()

template<Ring _K>
auto fun::dot1 ( const std::array< _K, 3 > &  v_a,
const std::array< _K, 3 > &  v_b 
) -> _K

Dot product of the (x,y)-components of two vectors (affine part)

\[ \mathrm{dot}_1(v_a,v_b) = v_{a,x} v_{b,x} + v_{a,y} v_{b,y} \]

Template Parameters
_K
Parameters
[in]v_a
[in]v_b
Returns
auto

◆ dot2()

template<Ring _K>
auto fun::dot2 ( const std::array< _K, 3 > &  v_a,
const std::array< _K, 3 > &  v_b 
) -> _K

Dot product of the (0,2)-component of two vectors.

\[ \mathrm{dot}_2(v_a,v_b) = v_{a,x} v_{b,x} + v_{a,z} v_{b,z} \]

Template Parameters
_K
Parameters
[in]v_a
[in]v_b
Returns
auto

◆ dot_c()

template<Ring _K>
auto fun::dot_c ( const std::array< _K, 3 > &  v_a,
const std::array< _K, 3 > &  v_b 
) -> _K

Dot product (full 3-component)

\[ v_a \cdot v_b = v_{a,x} v_{b,x} + v_{a,y} v_{b,y} + v_{a,z} v_{b,z} \]

Template Parameters
_K
Parameters
[in]v_a
[in]v_b
Returns
auto

◆ fB()

template<ProjectivePlaneCoord2 Line>
constexpr auto fun::fB ( const Line &  line_l) -> typename Line::Dual
constexpr

Convert a line to its direction vector in the affine plane.

Extracts the direction components (first two coordinates) of a line, effectively treating the line as a direction vector in the Euclidean plane.

Parameters
[in]line_lThe line to extract direction from
Returns
The dual type representing the direction vector

◆ gcd()

template<Integral Mn>
constexpr auto fun::gcd ( const Mn &  _m,
const Mn &  _n 
) -> Mn
constexpr

Greatest common divisor.

\[ \gcd(m,n) = \begin{cases} |n| & \text{if } m = 0 \\ \gcd(|m|, n \bmod |m|) & \text{otherwise} \end{cases} \]

Template Parameters
Mn
Parameters
[in]_m
[in]_n
Returns
Mn

◆ gcd_recur()

template<Integral Mn>
constexpr auto fun::gcd_recur ( const Mn &  _m,
const Mn &  _n 
) -> Mn
constexpr

Greatest common divider.

Template Parameters
Mn
Parameters
[in]_m
[in]_n
Returns
Mn

◆ harm_conj() [1/3]

template<ProjectivePlaneGeneric2 _Point>
constexpr auto fun::harm_conj ( const _Point &  A,
const _Point &  B,
const _Point &  C 
) -> _Point
constexpr

Compute the harmonic conjugate (generic version).

Given three collinear points A, B, C, returns the fourth point D such that (A, B; C, D) is a harmonic range. Generic version using auxiliary constructions.

\[ D = (Q \times S) \times AB \]

where \(P = AB^\perp\), \(R = P^\perp(C)\), \(S = (A \times R) \times (B \times P)\), \(Q = (B \times R) \times (A \times P)\).

Parameters
[in]AFirst point
[in]BSecond point
[in]CThird point (must be collinear with A and B)
Returns
constexpr Point The harmonic conjugate

◆ harm_conj() [2/3]

template<ProjectivePlane2 Point>
constexpr auto fun::harm_conj ( const Point &  A,
const Point &  B,
const Point &  C 
) -> Point
constexpr

Compute the harmonic conjugate of three collinear points.

Given three collinear points A, B, C, returns the fourth point D such that (A, B; C, D) is a harmonic range.

\[ (A, B; C, D) = -1 \quad\Longrightarrow\quad D = \operatorname{parametrize}(B \cdot l_C,\; A,\; A \cdot l_C,\; B) \]

dot_inline_dotgraph_1.png
Parameters
[in]AFirst point
[in]BSecond point
[in]CThird point (must be collinear with A and B)
Returns
constexpr Point The harmonic conjugate

◆ harm_conj() [3/3]

template<typename Value , class Point , class Line = typename Point::Dual>
constexpr auto fun::harm_conj ( const Point &  pt_a,
const Point &  pt_b,
const Point &  pt_c 
) -> Point
constexpr

Harmonic conjugate.

\[ (A, B; C, D) = -1 \]

Template Parameters
Value
Point
Parameters
[in]pt_a
[in]pt_b
[in]pt_c
Returns
Point

◆ incident()

template<typename Point , typename Line >
requires ProjectivePlane<Point, Line>
constexpr auto fun::incident ( const Point &  pt_p,
const Line &  ln_l 
) -> bool
constexpr

The code snippet is defining a function named incident that checks if a point pt_p is incident to a line ln_l in a projective plane. The function uses the dot method of the Point class and compares it to zero to determine if the point is incident to the line. The function returns a boolean value indicating whether the point is incident to the line or not.

Parameters
[in]pt_p
[in]ln_l
Returns
true
false

◆ involution()

template<typename Value , class Point , class Line >
constexpr auto fun::involution ( const Point &  origin,
const Line &  mirror,
const Point &  pt_p 
) -> Point
constexpr

Involution on a point.

Applies the involution defined by origin and mirror to point pt_p.

\[ p' = \operatorname{harm\_conj}(o,\; (p \times o) \times m,\; p) \]

Template Parameters
Value
Point
Point::Dual
Parameters
[in]origin
[in]mirror
[in]pt_p
Returns
Point

◆ is_harmonic()

template<ProjectivePlane2 Point>
constexpr auto fun::is_harmonic ( const Point &  A,
const Point &  B,
const Point &  C,
const Point &  D 
) -> bool
constexpr

Check if four points form a harmonic range.

Four points A, B, C, D form a harmonic range if the cross ratio (A, B; C, D) equals -1.

Parameters
[in]AFirst point
[in]BSecond point
[in]CThird point
[in]DFourth point
Returns
constexpr auto true if harmonic, false otherwise

◆ is_parallel()

template<ProjectivePlaneCoord2 Line>
constexpr auto fun::is_parallel ( const Line &  line_l,
const Line &  line_m 
) -> bool
constexpr

Check if two lines are parallel.

Uses the cross product of direction vectors to determine if two lines have the same direction.

Parameters
[in]line_lFirst line
[in]line_mSecond line
Returns
true if lines are parallel, false otherwise

◆ is_perpendicular() [1/2]

template<class Line , class Point = typename Line::Dual>
constexpr auto fun::is_perpendicular ( const Line &  l_1,
const Line &  l_2 
) -> bool
constexpr

Check if two lines are perpendicular (Cayley-Klein).

Uses the pole-polar relationship to check perpendicularity.

Template Parameters
LineThe line type
PointThe point type (dual of line)

◆ is_perpendicular() [2/2]

template<ProjectivePlaneCoord2 Line>
constexpr auto fun::is_perpendicular ( const Line &  line_l,
const Line &  line_m 
) -> bool
constexpr

Check if two lines are perpendicular.

Uses the dot product of direction vectors to determine if two lines meet at a right angle.

Parameters
[in]line_lFirst line
[in]line_mSecond line
Returns
true if lines are perpendicular, false otherwise

◆ join()

template<Ring _K>
constexpr auto fun::join ( const pg_point< _K > &  pt_p,
const pg_point< _K > &  pt_q 
) -> pg_line<_K>
constexpr

Return the join (product) of two points to form a line.

The join operation in projective geometry computes the line passing through two distinct points.

\[ l = p \times q \]

Parameters
[in]pt_pFirst point
[in]pt_qSecond point
Returns
pg_line<_K> The line through the two points

◆ lcm()

template<Integral Mn>
constexpr auto fun::lcm ( const Mn &  _m,
const Mn &  _n 
) -> Mn
constexpr

Least common multiple.

\[ \operatorname{lcm}(m,n) = \frac{|m|}{|m| \bmod |n|} \cdot |n| \]

Template Parameters
Mn
Parameters
[in]_m
[in]_n
Returns
Mn

◆ meet()

template<Ring _K>
constexpr auto fun::meet ( const pg_line< _K > &  ln_l,
const pg_line< _K > &  ln_m 
) -> pg_point<_K>
constexpr

Return the meet (intersection) of two lines to form a point. In projective geometry, two distinct lines always intersect at a point.

\[ p = l \times m \]

◆ midpoint()

template<ProjectivePlaneCoord2 Point>
constexpr auto fun::midpoint ( const Point &  a,
const Point &  b 
) -> Point
constexpr

Compute the midpoint of two points.

Returns the point that divides the segment AB in the ratio 1:1.

\[ M = \operatorname{parametrize}(b_z,\; a,\; a_z,\; b) \]

dot_inline_dotgraph_2.png
Parameters
[in]aFirst point
[in]bSecond point
Returns
Point The midpoint

◆ orthocenter() [1/2]

template<class Point , class Line = typename Point::Dual>
constexpr auto fun::orthocenter ( const std::array< Point, 3 > &  triangle) -> Point
constexpr

Compute the orthocenter of a triangle (Cayley-Klein).

Returns the intersection point of the three altitudes.

\[ H = h_{a_1} \times h_{a_2} \]

Parameters
[in]triangleArray of three non-collinear points
Returns
std::arrary<Line, 3>

◆ orthocenter() [2/2]

template<ProjectivePlaneCoord2 Point>
constexpr auto fun::orthocenter ( const Triple< Point > &  triangle) -> Point
constexpr

Compute the orthocenter of a triangle.

The orthocenter is the intersection point of all three altitudes of a triangle.

\[ H = h_{a_1} \times h_{a_2} \]

dot_inline_dotgraph_3.png
Parameters
[in]triangleArray of three non-collinear points
Returns
Point The orthocenter of the triangle

◆ parametrize()

template<typename Value , typename Point >
requires Ring<Value>
constexpr auto fun::parametrize ( const Value &  lambda_val,
const Point &  pt_p,
const Value &  mu_val,
const Point &  pt_q 
) -> Point
constexpr

Homogeneous parametrization of point or line (free function)

Returns lambda * p + mu * q in homogeneous coordinates. This free function is required by the ProjectivePlaneH concept and is used by Involution and other algorithms in proj_plane.hpp.

Template Parameters
ValueThe scalar type (coordinate type)
PointThe point or line type
Parameters
[in]lambdaFirst scalar coefficient
[in]pt_pFirst point/line
[in]muSecond scalar coefficient

\[ \lambda p + \mu q \]

[in]pt_qSecond point/line
Returns
Point The parametrized point/line

◆ persp() [1/2]

template<class Point , class Line = typename Point::Dual>
constexpr auto fun::persp ( const std::array< Point, 3 > &  tri1,
const std::array< Point, 3 > &  tri2 
) -> bool
constexpr

return whether two triangles are perspective

Template Parameters
PointPoint
Parameters
[in]tri1
[in]tri2
Returns
true
false

◆ persp() [2/2]

template<ProjectivePlanePrim2 Point>
constexpr auto fun::persp ( const Triple< Point > &  tri1,
const Triple< Point > &  tri2 
) -> bool
constexpr

return whether two triangles are perspective

Parameters
[in]tri1
[in]tri2
Returns
true
false

◆ plucker_c()

template<Ring _T, Ring _K>
auto fun::plucker_c ( const _T &  lambda_val,
const std::array< _K, 3 > &  v_a,
const _T &  mu_val,
const std::array< _K, 3 > &  v_b 
) -> std::array<_K, 3>

generic Plücker linear combination

\[ \lambda v_a + \mu v_b \]

Template Parameters
_Tscalar type
_Kcoordinate type
Parameters
[in]lambda_valscalar for v_a
[in]v_afirst vector
[in]mu_valscalar for v_b
[in]v_bsecond vector
Returns
lambda_val*v_a + mu_val*v_b

◆ Ptolemy()

template<typename T >
constexpr auto fun::Ptolemy ( const T &  quad) -> bool
constexpr

Check Ptolemy's theorem for a cyclic quadrilateral.

Ptolemy's theorem states that for a cyclic quadrilateral, the product of the diagonals equals the sum of the products of opposite sides.

\[ Q_{12}Q_{34} + Q_{23}Q_{14} = Q_{13}Q_{24} \]

or equivalently \(\mathrm{archimedes}(Q_{12}Q_{34},\; Q_{23}Q_{14},\; Q_{13}Q_{24}) = 0\).

Parameters
[in]quadArray of six side/diagonal measurements {Q12, Q23, Q34, Q14, Q13, Q24}
Returns
true if the quadrilateral satisfies Ptolemy's theorem

◆ quad1() [1/2]

template<typename K >
requires Integral<K>
constexpr auto fun::quad1 ( const K &  x1,
const K &  z1,
const K &  x2,
const K &  z2 
)
constexpr

Compute squared difference of ratios (integral version).

\[ \mathrm{quad}_1 = \left(\frac{x_1}{z_1} - \frac{x_2}{z_2}\right)^2 \]

Parameters
[in]x1First numerator
[in]z1First denominator
[in]x2Second numerator
[in]z2Second denominator
Returns
auto The squared difference of ratios

◆ quad1() [2/2]

template<typename K >
constexpr auto fun::quad1 ( const K &  x1,
const K &  z1,
const K &  x2,
const K &  z2 
)
constexpr

Compute squared difference of ratios (non-integral version).

\[ \mathrm{quad}_1 = \left(\frac{x_1}{z_1} - \frac{x_2}{z_2}\right)^2 \]

Returns
auto The squared difference of ratios

◆ quadrance()

template<ProjectivePlaneCoord2 Point>
constexpr auto fun::quadrance ( const Point &  a1,
const Point &  a2 
)
constexpr

Compute the quadrance between two points.

The quadrance is the squared distance between two points in the Euclidean plane:

\[ Q(A,B) = \left(\frac{A_x}{A_z} - \frac{B_x}{B_z}\right)^2 + \left(\frac{A_y}{A_z} - \frac{B_y}{B_z}\right)^2 \]

dot_inline_dotgraph_4.png
Parameters
[in]a1First point
[in]a2Second point
Returns
auto The quadrance (squared distance)

◆ quadrance_copy()

template<typename... Args>
constexpr auto fun::quadrance_copy ( const Args &...  args)
constexpr

Compute quadrances for multiple pairs of points.

Returns a tuple of quadrances for each pair of points.

Parameters
[in]argsPairs of points
Returns
std::tuple of quadrance values

◆ R()

template<ProjectivePlaneCoord2 Point>
constexpr auto fun::R ( const Point &  A,
const Point &  B,
const Point &  C,
const Point &  D 
)
constexpr

Compute the cross ratio of four collinear points.

Compute the cross ratio using projective construction.

Returns the cross ratio \(R(A, B; C, D)\) of four points on a line. Automatically chooses the best coordinate projection based on the points.

In homogeneous coordinates:

\[ R(A,B;C,D) = \frac{\mathrm{cross}_k(A,C)}{\mathrm{cross}_k(A,D)} \Big/ \frac{\mathrm{cross}_k(B,C)}{\mathrm{cross}_k(B,D)} \]

where \(k\) is chosen (0 or 1) to avoid degenerate projections.

Parameters
[in]AFirst point
[in]BSecond point
[in]CThird point
[in]DFourth point
Returns
constexpr auto The cross ratio

Returns the cross ratio R(A, B; C, D) using a projective construction that works with arbitrary projective planes.

Returns
constexpr auto The cross ratio

◆ R0()

template<ProjectivePlaneCoord2 Point>
constexpr auto fun::R0 ( const Point &  A,
const Point &  B,
const Point &  C,
const Point &  D 
)
constexpr

Compute cross ratio using yz-plane projection.

Returns the cross ratio R(A, B; C, D) using the yz-plane projection.

\[ R_0(A,B;C,D) = \frac{\mathrm{cross}_0(A,C)}{\mathrm{cross}_0(A,D)} \Big/ \frac{\mathrm{cross}_0(B,C)}{\mathrm{cross}_0(B,D)} \]

Parameters
[in]AFirst point
[in]BSecond point
[in]CThird point
[in]DFourth point
Returns
constexpr auto The cross ratio

◆ R1()

template<ProjectivePlaneCoord2 Point>
constexpr auto fun::R1 ( const Point &  A,
const Point &  B,
const Point &  C,
const Point &  D 
)
constexpr

Compute cross ratio using xz-plane projection.

Returns the cross ratio R(A, B; C, D) using the xz-plane projection.

\[ R_1(A,B;C,D) = \frac{\mathrm{cross}_1(A,C)}{\mathrm{cross}_1(A,D)} \Big/ \frac{\mathrm{cross}_1(B,C)}{\mathrm{cross}_1(B,D)} \]

Parameters
[in]AFirst point
[in]BSecond point
[in]CThird point
[in]DFourth point
Returns
constexpr auto The cross ratio

◆ ratio_ratio()

template<Ring K>
constexpr auto fun::ratio_ratio ( const K &  a,
const K &  b,
const K &  c,
const K &  d 
)
constexpr

Compute the ratio of two ratios.

\[ \frac{a/b}{c/d} = \frac{ad}{bc} \]

Parameters
[in]aFirst numerator
[in]bFirst denominator
[in]cSecond numerator
[in]dSecond denominator
Returns
auto The ratio of ratios

◆ reflect() [1/2]

template<ProjectivePlaneCoord2 Line>
constexpr auto fun::reflect ( const Line &  line_m)
constexpr

Create an involution that reflects across a line.

Returns an involution that performs reflection across the given line in the Euclidean plane.

\[ I_m(p) = \operatorname{Involution}(m,\; \bar{m}) \]

where \(\bar{m}\) is the direction vector of the mirror line.

dot_inline_dotgraph_5.png
Parameters
[in]line_mThe line of reflection (mirror)
Returns
Involution The reflection involution

◆ reflect() [2/2]

template<typename Value , class Point , class Line = typename Point::Dual>
constexpr auto fun::reflect ( const Line &  mirror,
const Point &  pt_p 
) -> Point
constexpr

Reflect a point across a line (Cayley-Klein).

Uses involution to reflect a point across a mirror line.

\[ p' = \operatorname{involution}(m^\perp,\; m,\; p) \]

where \(m^\perp\) is the pole of the mirror line.

Parameters
[in]mirrorThe line of reflection
[in]pt_pThe point to reflect
Returns
Point The reflected point

◆ sbase()

template<ProjectivePlaneCoord2 Line, typename T >
constexpr auto fun::sbase ( const Line &  l1,
const Line &  l2,
const T &  d 
)
constexpr

Base function for spread and cross-spread.

\[ \mathrm{sbase}(l_1, l_2, d) = \frac{d^2}{\mathrm{dot}_1(l_1,l_1)\,\mathrm{dot}_1(l_2,l_2)} \]

Parameters
[in]l1First line
[in]l2Second line
[in]dScalar value (cross or dot product)
Returns
auto

◆ spread()

template<ProjectivePlaneCoord2 Line>
constexpr auto fun::spread ( const Line &  l1,
const Line &  l2 
)
constexpr

Compute the spread between two lines.

The spread is the squared sine of the angle between two lines:

\[ s(l_1, l_2) = \frac{\mathrm{cross}_2(l_1, l_2)^2} {\mathrm{dot}_1(l_1, l_1) \mathrm{dot}_1(l_2, l_2)} \]

dot_inline_dotgraph_6.png
Parameters
[in]l1First line
[in]l2Second line
Returns
auto The spread

◆ sq()

template<typename T >
constexpr auto fun::sq ( const T &  a)
constexpr

Square function.

\[ \mathrm{sq}(a) = a^2 \]

Template Parameters
Tdata type
Parameters
[in]ainput value
Returns
a^2

◆ tri_altitude() [1/2]

template<class Point , class Line >
constexpr auto fun::tri_altitude ( const std::array< Point, 3 > &  triangle) -> std::array<Line, 3>
constexpr

Compute all three altitudes of a triangle (Cayley-Klein).

Returns an array containing the three altitude lines.

\[ \{h_{a_1},\; h_{a_2},\; h_{a_3}\} \]

Parameters
[in]triangleArray of three non-collinear points
Returns
std::arrary<Line, 3> Array of three altitude lines

◆ tri_altitude() [2/2]

template<ProjectivePlaneCoord2 Point>
constexpr auto fun::tri_altitude ( const Triple< Point > &  triangle)
constexpr

Compute all three altitudes of a triangle.

Returns an array containing the three altitude lines of the triangle.

\[ \{h_{a_1},\; h_{a_2},\; h_{a_3}\} \]

Parameters
[in]triangleArray of three non-collinear points
Returns
std::array<Line, 3> The three altitude lines

◆ tri_dual() [1/2]

template<class Point , class Line = typename Point::Dual>
constexpr auto fun::tri_dual ( const std::array< Point, 3 > &  triangle) -> std::array<Line, 3>
constexpr

Dual of triangle.

\[ \{l_1, l_2, l_3\} = \{a_2 \times a_3,\; a_1 \times a_3,\; a_1 \times a_2\} \]

Template Parameters
PointPoint
LineLine
Parameters
[in]triangle
Returns
std::array<Line, 3>

◆ tri_dual() [2/2]

template<ProjectivePlanePrim2 Point>
constexpr auto fun::tri_dual ( const Triple< Point > &  triangle)
constexpr

Compute the dual triangle (sides as points).

Returns the triangle formed by the three lines joining the vertices of the input triangle.

\[ \{l_1, l_2, l_3\} = \{a_2 \times a_3,\; a_1 \times a_3,\; a_1 \times a_2\} \]

Parameters
[in]triangleArray of three non-collinear points
Returns
auto Array of three lines (the sides)

◆ tri_func()

template<ProjectivePlanePrim2 Point, typename Fn >
constexpr auto fun::tri_func ( Fn &&  func,
const Triple< Point > &  triangle 
)
constexpr

Apply a binary function to all pairs of triangle vertices.

Returns an array with the function applied to each pair of distinct vertices of the triangle.

Parameters
[in]funcA binary function to apply
[in]triangleArray of three points
Returns
auto Array of three results

◆ tri_midpoint()

template<ProjectivePlaneCoord2 Point>
constexpr auto fun::tri_midpoint ( const Triple< Point > &  triangle) -> Triple<Point>
constexpr

Compute the midpoints of all three sides of a triangle.

Returns an array containing the midpoints of each side of the triangle.

\[ \{M_{a_1a_2},\; M_{a_2a_3},\; M_{a_1a_3}\} \]

Parameters
[in]triangleArray of three points
Returns
Triple<Point> Array of three midpoints

◆ tri_quadrance()

template<ProjectivePlaneCoord2 Point>
constexpr auto fun::tri_quadrance ( const Triple< Point > &  triangle)
constexpr

Compute the quadrances of a triangle's sides.

Returns an array with the quadrances of the three sides of the triangle.

Parameters
[in]triangleArray of three points
Returns
auto Array of three quadrance values

◆ tri_spread()

template<ProjectivePlaneCoord2 Line>
constexpr auto fun::tri_spread ( const Triple< Line > &  trilateral)
constexpr

Compute the spreads of a triangle's angles.

Returns an array with the spreads of the three angles of the triangle.

Parameters
[in]trilateralArray of three lines
Returns
auto Array of three spread values

◆ uc_point()

template<ProjectivePlaneCoord2 Point>
constexpr auto fun::uc_point ( const Value_type< Point > &  lda1,
const Value_type< Point > &  mu1 
)
constexpr

Compute a point on the unit circle from trigonometric parameters.

Creates a point on the unit circle using the parameterization (lambda^2 - mu^2, 2*lambda*mu, lambda^2 + mu^2).

\[ (\lambda^2 - \mu^2,\; 2\lambda\mu,\; \lambda^2 + \mu^2) \]

Parameters
[in]lda1The lambda parameter
[in]mu1The mu parameter
Returns
Point A point on the unit circle

◆ x_ratio()

template<typename Point , typename Line >
requires ProjectivePlane<Point, Line>
constexpr auto fun::x_ratio ( const Point &  A,
const Point &  B,
const Line &  line_l,
const Line &  line_m 
)
constexpr

Cross Ratio.

The cross ratio of four points with respect to two lines:

\[ R(A,B;l,m) = \frac{A \cdot l}{A \cdot m} \Big/ \frac{B \cdot l}{B \cdot m} \]

Template Parameters
Point
Line
Parameters
[in]Apoint A
[in]Bpoint B
[in]line_lline l
[in]line_mline m
Returns
cross ratio R(A,B;line_l,line_m)
Todo:
rewrite by projecting to the y-axis first [:2]