1.2
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...

Public Types

using DimType = Dim
 Helper to reference the dimension type. More...
 

Public Member Functions

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

Protected Attributes

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

Detailed Description

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

A basic ellipse with a center and 2 radii.

Member Typedef Documentation

◆ DimType

using DimType = Dim

Helper to reference the dimension type.

Constructor & Destructor Documentation

◆ EllipseType()

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]

constexpr EGT_NODISCARD PointType<Dim> center ( ) const
inlineconstexprnoexcept

Get the center of the ellipse.

◆ center() [2/2]

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

Set the center of the ellipse.

◆ perimeter()

constexpr EGT_NODISCARD Dim perimeter ( ) const
inlineconstexprnoexcept

Get the total perimeter of the ellipse.

This is technically just an approximation.

◆ point_on_circumference()

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]

constexpr EGT_NODISCARD Dim radiusa ( ) const
inlineconstexprnoexcept

Get the first radius of the ellipse.

◆ radiusa() [2/2]

constexpr void radiusa ( const Dim  radiusa)
inlineconstexprnoexcept

Set the first radius of the ellipse.

◆ radiusb() [1/2]

constexpr EGT_NODISCARD Dim radiusb ( ) const
inlineconstexprnoexcept

Get the second radius of the ellipse.

◆ radiusb() [2/2]

constexpr void radiusb ( const Dim  radiusb)
inlineconstexprnoexcept

Set the second radius of the ellipse.

Member Data Documentation

◆ m_center

PointType<Dim> m_center
protected

Center point of the arc.

◆ m_radiusa

Dim m_radiusa {0}
protected

A radius.

◆ m_radiusb

Dim m_radiusb {0}
protected

B radius.