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

Simple x,y coordinate. More...

#include <geometry.h>

Public Types

using DimType = Dim
 Helper to reference the dimension type.
 

Public Member Functions

constexpr PointType () noexcept=default
 
template<class Dim2 >
constexpr PointType (const PointType< Dim2 > &p)
 
constexpr PointType (Dim x, Dim y) noexcept
 
template<class T >
EGT_NODISCARD T angle_to (const PointType &point) const noexcept
 Return the angle in radians from this point to get to another.
 
EGT_NODISCARD Dim distance_to (const PointType &point) const noexcept
 Calculate the straight line distance to another point.
 
constexpr PointTypeoperator*= (const PointType &rhs) noexcept
 PointType operator.
 
template<class T >
constexpr PointTypeoperator*= (const T &rhs) noexcept
 PointType operator.
 
constexpr PointTypeoperator+= (const PointType &rhs) noexcept
 PointType operator.
 
template<class T >
constexpr PointTypeoperator+= (const T &rhs) noexcept
 PointType operator.
 
constexpr PointTypeoperator-= (const PointType &rhs) noexcept
 PointType operator.
 
template<class T >
constexpr PointTypeoperator-= (const T &rhs) noexcept
 PointType operator.
 
constexpr PointTypeoperator/= (const PointType &rhs) noexcept
 PointType operator.
 
template<class T >
constexpr PointTypeoperator/= (const T &rhs) noexcept
 PointType operator.
 
template<class T >
PointType point_on_circumference (T radius, T angle) const noexcept
 If this point is the center of a circle, return a new point that is on the circumference of the circle at the specified angle.
 
EGT_NODISCARD constexpr Dim x () const noexcept
 Get the x value.
 
constexpr void x (Dim x) noexcept
 Set the x value.
 
EGT_NODISCARD constexpr Dim y () const noexcept
 Get the y value.
 
constexpr void y (Dim y) noexcept
 Set the y value.
 

Protected Attributes

Dim m_x {0}
 X value.
 
Dim m_y {0}
 Y value.
 

Detailed Description

template<class Dim, detail::Compatible DimCompat = detail::Compatible::normal>
class egt::v1::PointType< Dim, DimCompat >

Simple x,y coordinate.

Typically Point, PointF, DisplayPoint are used as aliases.

Member Typedef Documentation

◆ DimType

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
using DimType = Dim

Helper to reference the dimension type.

Constructor & Destructor Documentation

◆ PointType() [1/3]

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
constexpr PointType ( )
constexprdefaultnoexcept

◆ PointType() [2/3]

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
constexpr PointType ( Dim  x,
Dim  y 
)
inlineconstexprnoexcept
Parameters
[in]xX value.
[in]yY value.

◆ PointType() [3/3]

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
template<class Dim2 >
constexpr PointType ( const PointType< Dim2 > &  p)
inlineconstexpr

Member Function Documentation

◆ angle_to()

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
template<class T >
EGT_NODISCARD T angle_to ( const PointType< Dim, DimCompat > &  point) const
inlinenoexcept

Return the angle in radians from this point to get to another.

Parameters
pointThe other point.

◆ distance_to()

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
EGT_NODISCARD Dim distance_to ( const PointType< Dim, DimCompat > &  point) const
inlinenoexcept

Calculate the straight line distance to another point.

Parameters
pointThe other point.

◆ operator*=() [1/2]

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
constexpr PointType & operator*= ( const PointType< Dim, DimCompat > &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ operator*=() [2/2]

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
template<class T >
constexpr PointType & operator*= ( const T &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ operator+=() [1/2]

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
constexpr PointType & operator+= ( const PointType< Dim, DimCompat > &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ operator+=() [2/2]

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
template<class T >
constexpr PointType & operator+= ( const T &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ operator-=() [1/2]

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
constexpr PointType & operator-= ( const PointType< Dim, DimCompat > &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ operator-=() [2/2]

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
template<class T >
constexpr PointType & operator-= ( const T &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ operator/=() [1/2]

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
constexpr PointType & operator/= ( const PointType< Dim, DimCompat > &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ operator/=() [2/2]

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
template<class T >
constexpr PointType & operator/= ( const T &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ point_on_circumference()

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
template<class T >
PointType point_on_circumference ( radius,
angle 
) const
inlinenoexcept

If this point is the center of a circle, return a new point that is on the circumference of the circle at the specified angle.

Parameters
radiusThe radius of the circle.
angleThe angle in radians.

◆ x() [1/2]

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
EGT_NODISCARD constexpr Dim x ( ) const
inlineconstexprnoexcept

Get the x value.

◆ x() [2/2]

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
constexpr void x ( Dim  x)
inlineconstexprnoexcept

Set the x value.

◆ y() [1/2]

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
EGT_NODISCARD constexpr Dim y ( ) const
inlineconstexprnoexcept

Get the y value.

◆ y() [2/2]

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
constexpr void y ( Dim  y)
inlineconstexprnoexcept

Set the y value.

Member Data Documentation

◆ m_x

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
Dim m_x {0}
protected

X value.

◆ m_y

template<class Dim , detail::Compatible DimCompat = detail::Compatible::normal>
Dim m_y {0}
protected

Y value.