Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
graphics::PointType< DataType > Struct Template Referencefinal

A point in 2D space. More...

#include <Point.h>

Public Member Functions

PointTypeoperator+= (PointType rhs) noexcept
 
PointTypeoperator-= (PointType rhs) noexcept
 
PointTypeoperator*= (PointType rhs) noexcept
 
PointTypeoperator/= (PointType rhs) noexcept
 
template<typename ScaleType >
PointTypeoperator*= (ScaleType scale) noexcept
 
template<typename ScaleType >
PointTypeoperator/= (ScaleType scale) noexcept
 
PointType operator- () const noexcept
 
bool IsZero () const noexcept
 

Public Attributes

DataType x {}
 
DataType y {}
 

Detailed Description

template<typename DataType>
struct graphics::PointType< DataType >

A point in 2D space.

Definition at line 22 of file Point.h.

Member Function Documentation

◆ IsZero()

template<typename DataType >
bool graphics::PointType< DataType >::IsZero ( ) const
inlinenoexcept

Definition at line 82 of file Point.h.

83 {
84 return std::abs(x) <= std::numeric_limits<DataType>::epsilon() &&
85 std::abs(y) <= std::numeric_limits<DataType>::epsilon();
86 }
DataType y
Definition: Point.h:25
DataType x
Definition: Point.h:24

References graphics::PointType< DataType >::x, and graphics::PointType< DataType >::y.

◆ operator*=() [1/2]

template<typename DataType >
PointType & graphics::PointType< DataType >::operator*= ( PointType< DataType >  rhs)
inlinenoexcept

Definition at line 43 of file Point.h.

44 {
45 x *= rhs.x;
46 y *= rhs.y;
47
48 return *this;
49 }

References graphics::PointType< DataType >::x, and graphics::PointType< DataType >::y.

◆ operator*=() [2/2]

template<typename DataType >
template<typename ScaleType >
PointType & graphics::PointType< DataType >::operator*= ( ScaleType  scale)
inlinenoexcept

Definition at line 59 of file Point.h.

60 {
61 x = static_cast<DataType>(x * scale);
62 y = static_cast<DataType>(y * scale);
63
64 return *this;
65 }

References graphics::PointType< DataType >::x, and graphics::PointType< DataType >::y.

◆ operator+=()

template<typename DataType >
PointType & graphics::PointType< DataType >::operator+= ( PointType< DataType >  rhs)
inlinenoexcept

Definition at line 27 of file Point.h.

28 {
29 x += rhs.x;
30 y += rhs.y;
31
32 return *this;
33 }

References graphics::PointType< DataType >::x, and graphics::PointType< DataType >::y.

◆ operator-()

template<typename DataType >
PointType graphics::PointType< DataType >::operator- ( ) const
inlinenoexcept

Definition at line 75 of file Point.h.

76 {
77 static_assert(std::is_signed_v<DataType>);
78
79 return { -x, -y };
80 }

References graphics::PointType< DataType >::x, and graphics::PointType< DataType >::y.

◆ operator-=()

template<typename DataType >
PointType & graphics::PointType< DataType >::operator-= ( PointType< DataType >  rhs)
inlinenoexcept

Definition at line 35 of file Point.h.

36 {
37 x -= rhs.x;
38 y -= rhs.y;
39
40 return *this;
41 }

References graphics::PointType< DataType >::x, and graphics::PointType< DataType >::y.

◆ operator/=() [1/2]

template<typename DataType >
PointType & graphics::PointType< DataType >::operator/= ( PointType< DataType >  rhs)
inlinenoexcept

Definition at line 51 of file Point.h.

52 {
53 x /= rhs.x;
54 y /= rhs.y;
55
56 return *this;
57 }

References graphics::PointType< DataType >::x, and graphics::PointType< DataType >::y.

◆ operator/=() [2/2]

template<typename DataType >
template<typename ScaleType >
PointType & graphics::PointType< DataType >::operator/= ( ScaleType  scale)
inlinenoexcept

Definition at line 67 of file Point.h.

68 {
69 x = static_cast<DataType>(x / scale);
70 y = static_cast<DataType>(y / scale);
71
72 return *this;
73 }

References graphics::PointType< DataType >::x, and graphics::PointType< DataType >::y.

Member Data Documentation

◆ x

template<typename DataType >
DataType graphics::PointType< DataType >::x {}

◆ y

template<typename DataType >
DataType graphics::PointType< DataType >::y {}

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