1.10
Public Types | Public Member Functions | Protected Attributes | List of all members
EllipseType< Dim > Class Template Reference

A basic ellipse with a center and 2 radii. More...

#include <geometry.h>

Public Types

using DimType = Dim
 Helper to reference the dimension type.
 

Public Member Functions

constexpr EllipseType (const PointType< Dim > &center={}, Dim radiusa={}, Dim radiusb={}) noexcept
 
EGT_NODISCARD constexpr PointType< Dim > center () const noexcept
 Get the center of the ellipse.
 
constexpr void center (const PointType< Dim > &center) noexcept
 Set the center of the ellipse.
 
EGT_NODISCARD constexpr Dim perimeter () const noexcept
 Get the total perimeter of the ellipse.
 
template<class T >
PointType< Dim > point_on_circumference (T angle) noexcept
 Return the point on the circumference of the ellipse at the given angle.
 
EGT_NODISCARD constexpr Dim radiusa () const noexcept
 Get the first radius of the ellipse.
 
constexpr void radiusa (const Dim radiusa) noexcept
 Set the first radius of the ellipse.
 
EGT_NODISCARD constexpr Dim radiusb () const noexcept
 Get the second radius of the ellipse.
 
constexpr void radiusb (const Dim radiusb) noexcept
 Set the second radius of the ellipse.
 

Protected Attributes

PointType< Dim > m_center
 Center point of the arc.
 
Dim m_radiusa {0}
 A radius.
 
Dim m_radiusb {0}
 B radius.
 

Detailed Description

template<class Dim>
class egt::v1::EllipseType< Dim >

A basic ellipse with a center and 2 radii.

Member Typedef Documentation

◆ DimType

template<class Dim >
using DimType = Dim

Helper to reference the dimension type.

Constructor & Destructor Documentation

◆ EllipseType()

template<class Dim >
constexpr EllipseType ( const PointType< Dim > &  center = {},
Dim  radiusa = {},
Dim  radiusb = {} 
)
inlineexplicitconstexprnoexcept
Parameters
[in]centerCenter of the ellipse.
[in]radiusaFirst radius of the ellipse.
[in]radiusbSecond radius of the ellipse.

Member Function Documentation

◆ center() [1/2]

template<class Dim >
EGT_NODISCARD constexpr PointType< Dim > center ( ) const
inlineconstexprnoexcept

Get the center of the ellipse.

◆ center() [2/2]

template<class Dim >
constexpr void center ( const PointType< Dim > &  center)
inlineconstexprnoexcept

Set the center of the ellipse.

◆ perimeter()

template<class Dim >
EGT_NODISCARD constexpr Dim perimeter ( ) const
inlineconstexprnoexcept

Get the total perimeter of the ellipse.

This is technically just an approximation.

◆ point_on_circumference()

template<class Dim >
template<class T >
PointType< Dim > point_on_circumference ( angle)
inlinenoexcept

Return the point on the circumference of the ellipse at the given angle.

Parameters
angleThe angle in radians on the ellipse, with the center in the middle of the ellipse.

◆ radiusa() [1/2]

template<class Dim >
EGT_NODISCARD constexpr Dim radiusa ( ) const
inlineconstexprnoexcept

Get the first radius of the ellipse.

◆ radiusa() [2/2]

template<class Dim >
constexpr void radiusa ( const Dim  radiusa)
inlineconstexprnoexcept

Set the first radius of the ellipse.

◆ radiusb() [1/2]

template<class Dim >
EGT_NODISCARD constexpr Dim radiusb ( ) const
inlineconstexprnoexcept

Get the second radius of the ellipse.

◆ radiusb() [2/2]

template<class Dim >
constexpr void radiusb ( const Dim  radiusb)
inlineconstexprnoexcept

Set the second radius of the ellipse.

Member Data Documentation

◆ m_center

template<class Dim >
PointType<Dim> m_center
protected

Center point of the arc.

◆ m_radiusa

template<class Dim >
Dim m_radiusa {0}
protected

A radius.

◆ m_radiusb

template<class Dim >
Dim m_radiusb {0}
protected

B radius.