ProjGeom 1.0.11
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
fun::Conic Class Reference

A conic section represented by a symmetric 3x3 matrix. More...

#include <conic.hpp>

Public Types

using Mat3x3 = std::array< std::array< Fraction, 3 >, 3 >
 

Public Member Functions

constexpr Conic (Mat3x3 matrix)
 Construct a new Conic from a symmetric matrix.
 
constexpr auto contains (const PgPoint &point) const -> bool
 Check whether a point lies on the conic.
 
constexpr auto polar (const PgPoint &point) const -> PgLine
 Polar line of a point with respect to the conic.
 
constexpr auto tangent (const PgPoint &point) const -> PgLine
 Tangent line at a point on the conic.
 
constexpr auto pole (const PgLine &line) const -> PgPoint
 Pole of a line with respect to the conic (placeholder).
 
auto intersect (const PgLine &line) const -> std::vector< PgPoint >
 Intersection of a line with the conic (placeholder).
 
constexpr auto discriminant () const -> Fraction
 Discriminant of the conic (det of the 2x2 upper-left block).
 
constexpr auto conic_type () const -> ConicType
 Determine the conic type from the discriminant.
 
constexpr auto matrix () const -> const Mat3x3 &
 Access the matrix.
 
constexpr auto operator== (const Conic &other) const -> bool
 

Static Public Member Functions

static constexpr auto circle (std::int64_t center_x, std::int64_t center_y, std::int64_t radius_sq) -> Conic
 Create a circle with centre (cx, cy) and squared radius r².
 
static constexpr auto unit_circle () -> Conic
 Create a unit circle centred at the origin.
 
static constexpr auto parabola (const Fraction &a) -> Conic
 Create a parabola \(y = a x^2\).
 

Detailed Description

A conic section represented by a symmetric 3x3 matrix.

A point \(\mathbf{x}=(x:y:z)\) lies on the conic iff \(\mathbf{x}^T Q \mathbf{x}=0\).

Member Typedef Documentation

◆ Mat3x3

using fun::Conic::Mat3x3 = std::array<std::array<Fraction, 3>, 3>

Constructor & Destructor Documentation

◆ Conic()

constexpr fun::Conic::Conic ( Mat3x3  matrix)
inlineexplicitconstexpr

Construct a new Conic from a symmetric matrix.

Parameters
[in]matrixThe 3x3 symmetric matrix Q.

Member Function Documentation

◆ circle()

static constexpr auto fun::Conic::circle ( std::int64_t  center_x,
std::int64_t  center_y,
std::int64_t  radius_sq 
) -> Conic
inlinestaticconstexpr

Create a circle with centre (cx, cy) and squared radius r².

\[ (x-c_x)^2 + (y-c_y)^2 = r^2 \]

Parameters
[in]center_xX coordinate of centre.
[in]center_yY coordinate of centre.
[in]radius_sqSquared radius.
Returns
constexpr Conic

◆ conic_type()

constexpr auto fun::Conic::conic_type ( ) const -> ConicType
inlineconstexpr

Determine the conic type from the discriminant.

Returns
ConicType

◆ contains()

constexpr auto fun::Conic::contains ( const PgPoint point) const -> bool
inlineconstexpr

Check whether a point lies on the conic.

\[ \mathbf{x}^T Q \mathbf{x} = 0 \]

Parameters
[in]ptThe point to test.
Returns
true if the point lies on the conic.

◆ discriminant()

constexpr auto fun::Conic::discriminant ( ) const -> Fraction
inlineconstexpr

Discriminant of the conic (det of the 2x2 upper-left block).

\[ \Delta = a e - b d \]

>0 → ellipse, =0 → parabola, <0 → hyperbola.

Returns
Fraction

◆ intersect()

auto fun::Conic::intersect ( const PgLine line) const -> std::vector<PgPoint>
inline

Intersection of a line with the conic (placeholder).

Currently returns an empty vector.

Parameters
[in]lineThe line.
Returns
std::vector<PgPoint> (0, 1, or 2 points).

◆ matrix()

constexpr auto fun::Conic::matrix ( ) const -> const Mat3x3&
inlineconstexpr

Access the matrix.

◆ operator==()

constexpr auto fun::Conic::operator== ( const Conic other) const -> bool
inlineconstexpr

◆ parabola()

static constexpr auto fun::Conic::parabola ( const Fraction a) -> Conic
inlinestaticconstexpr

Create a parabola \(y = a x^2\).

Parameters
[in]aCoefficient.
Returns
constexpr Conic

◆ polar()

constexpr auto fun::Conic::polar ( const PgPoint point) const -> PgLine
inlineconstexpr

Polar line of a point with respect to the conic.

\[ \mathbf{l} = Q \mathbf{x} \]

Parameters
[in]pointThe point.
Returns
PgLine

◆ pole()

constexpr auto fun::Conic::pole ( const PgLine line) const -> PgPoint
inlineconstexpr

Pole of a line with respect to the conic (placeholder).

\[ \mathbf{x} = Q^{-1} \mathbf{l} \]

Currently returns a point with the same coordinates as the line.

Parameters
[in]lineThe line.
Returns
PgPoint

◆ tangent()

constexpr auto fun::Conic::tangent ( const PgPoint point) const -> PgLine
inlineconstexpr

Tangent line at a point on the conic.

At a point \(\mathbf{p}\) on the conic, the tangent is the polar:

\[ \mathbf{t} = Q \mathbf{p} \]

Parameters
[in]pointA point on the conic.
Returns
PgLine

◆ unit_circle()

static constexpr auto fun::Conic::unit_circle ( ) -> Conic
inlinestaticconstexpr

Create a unit circle centred at the origin.

\[ x^2 + y^2 = 1 \]

Returns
constexpr Conic

The documentation for this class was generated from the following file: