ToyGine2 26.2.0
Game Engine for retro consoles
Loading...
Searching...
No Matches
toy::geometry Namespace Reference

Geometry types and utilities: sections (intervals), circles, ellipses, and related APIs. More...

Classes

class  Circle
 Circle in 2D with center and radius. More...
class  Ellipse
 Axis-aligned ellipse in 2D with center and semi-axes. More...
class  Section
 One-dimensional interval [start, end] over a numeric endpoint type. More...

Concepts

concept  CircleComponent
 Concept satisfied when T is a component type allowed as toy::geometry::Circle template parameter.
concept  EllipseComponent
 Concept satisfied when T is a component type allowed as toy::geometry::Ellipse template parameter.
concept  SectionEndpoint
 Concept satisfied when T is an endpoint type allowed as toy::geometry::Section template parameter.

Functions

template<CircleComponent T>
constexpr bool operator== (const Circle< T > &left, const Circle< T > &right) noexcept
 Equality of two circles: same center and radius (tolerance-based for float, exact for fixed-point).
template<CircleComponent T>
constexpr bool operator!= (const Circle< T > &left, const Circle< T > &right) noexcept
 Inequality of two circles.
template<EllipseComponent T>
constexpr bool operator== (const Ellipse< T > &left, const Ellipse< T > &right) noexcept
 Equality of two ellipses: same center and radiuses (tolerance-based for float, exact for fixed-point).
template<EllipseComponent T>
constexpr bool operator!= (const Ellipse< T > &left, const Ellipse< T > &right) noexcept
 Inequality of two ellipses.
template<SectionEndpoint T>
constexpr bool operator== (const Section< T > &left, const Section< T > &right) noexcept
 Equality of two sections: exact comparison for integral and fixed-point, approximate for floating-point.
template<SectionEndpoint T>
constexpr bool operator!= (const Section< T > &left, const Section< T > &right) noexcept
 Inequality of two sections.
template<CircleComponent T>
 Circle (const math::Vector2< T > &, const T &) -> Circle< T >
 Deduction guide: enables Circle(center, radius) without an explicit template argument when both arguments have the same toy::geometry::CircleComponent type.
template<EllipseComponent T>
 Ellipse (const math::Vector2< T > &, const math::Vector2< T > &) -> Ellipse< T >
 Deduction guide: enables Ellipse(center, radiuses) without an explicit template argument when both arguments have the same toy::geometry::EllipseComponent type.
template<SectionEndpoint T>
 Section (const T &, const T &) -> Section< T >
 Deduction guide: enables Section(a, b) without an explicit template argument when both arguments have the same toy::geometry::SectionEndpoint type.

Detailed Description

Geometry types and utilities: sections (intervals), circles, ellipses, and related APIs.

Function Documentation

◆ Circle()

template<CircleComponent T>
toy::geometry::Circle ( const math::Vector2< T > & ,
const T &  ) -> Circle< T >

Deduction guide: enables Circle(center, radius) without an explicit template argument when both arguments have the same toy::geometry::CircleComponent type.

Template Parameters
TComponent type; must satisfy toy::geometry::CircleComponent.

◆ Ellipse()

template<EllipseComponent T>
toy::geometry::Ellipse ( const math::Vector2< T > & ,
const math::Vector2< T > &  ) -> Ellipse< T >

Deduction guide: enables Ellipse(center, radiuses) without an explicit template argument when both arguments have the same toy::geometry::EllipseComponent type.

Template Parameters
TComponent type; must satisfy toy::geometry::EllipseComponent.

◆ operator!=() [1/3]

template<CircleComponent T>
bool toy::geometry::operator!= ( const Circle< T > & left,
const Circle< T > & right )
nodiscardconstexprnoexcept

Inequality of two circles.

Template Parameters
TComponent type; must satisfy toy::geometry::CircleComponent.
Parameters
leftFirst circle.
rightSecond circle.
Returns
true if left and right differ, i.e. !(left == right).
See also
operator==()

◆ operator!=() [2/3]

template<EllipseComponent T>
bool toy::geometry::operator!= ( const Ellipse< T > & left,
const Ellipse< T > & right )
nodiscardconstexprnoexcept

Inequality of two ellipses.

Template Parameters
TComponent type; must satisfy toy::geometry::EllipseComponent.
Parameters
leftFirst ellipse.
rightSecond ellipse.
Returns
true if left and right differ, i.e. !(left == right).
See also
operator==()

◆ operator!=() [3/3]

template<SectionEndpoint T>
bool toy::geometry::operator!= ( const Section< T > & left,
const Section< T > & right )
nodiscardconstexprnoexcept

Inequality of two sections.

Template Parameters
TEndpoint type; must satisfy toy::geometry::SectionEndpoint.
Parameters
leftFirst section.
rightSecond section.
Returns
true if left and right have different bounds, i.e. !(left == right).
See also
operator==()

◆ operator==() [1/3]

template<CircleComponent T>
bool toy::geometry::operator== ( const Circle< T > & left,
const Circle< T > & right )
nodiscardconstexprnoexcept

Equality of two circles: same center and radius (tolerance-based for float, exact for fixed-point).

Template Parameters
TComponent type; must satisfy toy::geometry::CircleComponent.
Parameters
leftFirst circle.
rightSecond circle.
Returns
true if left and right have equal center and radius.
See also
operator!=()

◆ operator==() [2/3]

template<EllipseComponent T>
bool toy::geometry::operator== ( const Ellipse< T > & left,
const Ellipse< T > & right )
nodiscardconstexprnoexcept

Equality of two ellipses: same center and radiuses (tolerance-based for float, exact for fixed-point).

Template Parameters
TComponent type; must satisfy toy::geometry::EllipseComponent.
Parameters
leftFirst ellipse.
rightSecond ellipse.
Returns
true if left and right have equal center and radiuses.
See also
operator!=()

◆ operator==() [3/3]

template<SectionEndpoint T>
bool toy::geometry::operator== ( const Section< T > & left,
const Section< T > & right )
nodiscardconstexprnoexcept

Equality of two sections: exact comparison for integral and fixed-point, approximate for floating-point.

For floating-point T compares bounds with math::isEqual. For signed integral and fixed-point T compares left.start with right.start and left.end with right.end exactly.

Template Parameters
TEndpoint type; must satisfy toy::geometry::SectionEndpoint.
Parameters
leftFirst section.
rightSecond section.
Returns
true if left and right have equal bounds (exact for integral/fixed-point, within default epsilon for floating-point).
See also
operator!=()

◆ Section()

template<SectionEndpoint T>
toy::geometry::Section ( const T & ,
const T &  ) -> Section< T >

Deduction guide: enables Section(a, b) without an explicit template argument when both arguments have the same toy::geometry::SectionEndpoint type.

Template Parameters
TEndpoint type; must satisfy toy::geometry::SectionEndpoint.