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

Simple x,y coordinate. More...

Public Types

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

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. More...
 
EGT_NODISCARD Dim distance_to (const PointType &point) const noexcept
 Calculate the straight line distance to another point. More...
 
constexpr PointTypeoperator*= (const PointType &rhs) noexcept
 PointType operator. More...
 
template<class T >
constexpr PointTypeoperator*= (const T &rhs) noexcept
 PointType operator. More...
 
constexpr PointTypeoperator+= (const PointType &rhs) noexcept
 PointType operator. More...
 
template<class T >
constexpr PointTypeoperator+= (const T &rhs) noexcept
 PointType operator. More...
 
constexpr PointTypeoperator-= (const PointType &rhs) noexcept
 PointType operator. More...
 
template<class T >
constexpr PointTypeoperator-= (const T &rhs) noexcept
 PointType operator. More...
 
constexpr PointTypeoperator/= (const PointType &rhs) noexcept
 PointType operator. More...
 
template<class T >
constexpr PointTypeoperator/= (const T &rhs) noexcept
 PointType operator. More...
 
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. More...
 
constexpr EGT_NODISCARD Dim x () const noexcept
 Get the x value. More...
 
constexpr void x (Dim x) noexcept
 Set the x value. More...
 
constexpr EGT_NODISCARD Dim y () const noexcept
 Get the y value. More...
 
constexpr void y (Dim y) noexcept
 Set the y value. More...
 

Protected Attributes

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

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

using DimType = Dim

Helper to reference the dimension type.

Constructor & Destructor Documentation

◆ PointType() [1/3]

constexpr PointType ( )
constexprdefaultnoexcept

◆ PointType() [2/3]

constexpr PointType ( Dim  x,
Dim  y 
)
inlineconstexprnoexcept
Parameters
[in]xX value.
[in]yY value.

◆ PointType() [3/3]

constexpr PointType ( const PointType< Dim2 > &  p)
inlineconstexpr

Member Function Documentation

◆ angle_to()

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()

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]

constexpr PointType& operator*= ( const PointType< Dim, DimCompat > &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ operator*=() [2/2]

constexpr PointType& operator*= ( const T &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ operator+=() [1/2]

constexpr PointType& operator+= ( const PointType< Dim, DimCompat > &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ operator+=() [2/2]

constexpr PointType& operator+= ( const T &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ operator-=() [1/2]

constexpr PointType& operator-= ( const PointType< Dim, DimCompat > &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ operator-=() [2/2]

constexpr PointType& operator-= ( const T &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ operator/=() [1/2]

constexpr PointType& operator/= ( const PointType< Dim, DimCompat > &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ operator/=() [2/2]

constexpr PointType& operator/= ( const T &  rhs)
inlineconstexprnoexcept

PointType operator.

◆ point_on_circumference()

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]

constexpr EGT_NODISCARD Dim x ( ) const
inlineconstexprnoexcept

Get the x value.

◆ x() [2/2]

constexpr void x ( Dim  x)
inlineconstexprnoexcept

Set the x value.

◆ y() [1/2]

constexpr EGT_NODISCARD Dim y ( ) const
inlineconstexprnoexcept

Get the y value.

◆ y() [2/2]

constexpr void y ( Dim  y)
inlineconstexprnoexcept

Set the y value.

Member Data Documentation

◆ m_x

Dim m_x {0}
protected

X value.

◆ m_y

Dim m_y {0}
protected

Y value.