GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::Ellipse< T > Struct Template Reference

Flat 2D ellipse shape with a center and axis-aligned radii. More...

#include <GREM/core/geometry.hpp>

Public Types

using Component = T
 Scalar coordinate component type.

Public Member Functions

template<typename U>
GREM_ALWAYS_INLINE constexpr operator Ellipse< U > () const noexcept
 Convert this ellipse to an equivalent ellipse of another scalar type.
constexpr operator Ellipsoid< 2, T > () const noexcept
 Convert this ellipse to an equivalent 2D ellipsoid.
bool operator== (const Ellipse &other) const =default
 Compare this ellipse to another for equality.
constexpr bool contains (const Point< 2, T > &point) const noexcept
 Check if a given point is contained within the extents of this ellipse.
constexpr Box< 2, T > getBoundingBox () const noexcept
 Get the axis-aligned bounding box of the ellipse.
constexpr Ellipsoid< 2, T > toEllipsoid () const noexcept
 Convert this shape to an equivalent ellipsoid.

Public Attributes

Point< 2, T > center
 Position of the center of the ellipse.
Length< 2, T > radii
 Radii of the ellipse along each axis.

Static Public Attributes

static constexpr size_t RANK = 2
 Number of dimensions of the vector space.

Detailed Description

template<typename T>
struct grem::Ellipse< T >

Flat 2D ellipse shape with a center and axis-aligned radii.

Template Parameters
Tscalar coordinate component type.

Member Typedef Documentation

◆ Component

template<typename T>
using grem::Ellipse< T >::Component = T

Scalar coordinate component type.

Member Function Documentation

◆ operator Ellipse< U >()

template<typename T>
template<typename U>
GREM_ALWAYS_INLINE constexpr grem::Ellipse< T >::operator Ellipse< U > ( ) const
inlineexplicitconstexprnoexcept

Convert this ellipse to an equivalent ellipse of another scalar type.

Returns
the converted ellipse.

◆ operator Ellipsoid< 2, T >()

template<typename T>
grem::Ellipse< T >::operator Ellipsoid< 2, T > ( ) const
inlineconstexprnoexcept

Convert this ellipse to an equivalent 2D ellipsoid.

Returns
the ellipse as an ellipsoid.

◆ operator==()

template<typename T>
bool grem::Ellipse< T >::operator== ( const Ellipse< T > & other) const
nodiscarddefault

Compare this ellipse to another for equality.

Parameters
otherthe ellipse to compare this ellipse to.
Returns
true if the ellipses are equal, false otherwise.

◆ contains()

template<typename T>
bool grem::Ellipse< T >::contains ( const Point< 2, T > & point) const
inlinenodiscardconstexprnoexcept

Check if a given point is contained within the extents of this ellipse.

Parameters
pointpoint to check.
Returns
true if the ellipse contains the given point, false otherwise.

◆ getBoundingBox()

template<typename T>
Box< 2, T > grem::Ellipse< T >::getBoundingBox ( ) const
inlinenodiscardconstexprnoexcept

Get the axis-aligned bounding box of the ellipse.

Returns
an axis-aligned box that contains the entire ellipse.

◆ toEllipsoid()

template<typename T>
Ellipsoid< 2, T > grem::Ellipse< T >::toEllipsoid ( ) const
inlinenodiscardconstexprnoexcept

Convert this shape to an equivalent ellipsoid.

Returns
an ellipsoid that is equivalent to this shape.

Member Data Documentation

◆ RANK

template<typename T>
size_t grem::Ellipse< T >::RANK = 2
staticconstexpr

Number of dimensions of the vector space.

◆ center

template<typename T>
Point<2, T> grem::Ellipse< T >::center

Position of the center of the ellipse.

◆ radii

template<typename T>
Length<2, T> grem::Ellipse< T >::radii

Radii of the ellipse along each axis.


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