Scroom  0.14
Scroom::Utils::Point< T > Class Template Reference

#include <point.hh>

Inheritance diagram for Scroom::Utils::Point< T >:
Inheritance graph
Collaboration diagram for Scroom::Utils::Point< T >:
Collaboration graph

Public Types

using value_type = T
 

Public Member Functions

 Point ()=default
 
 Point (value_type xy)
 
 Point (value_type x_, value_type y_)
 
template<typename U >
 Point (Point< U > other)
 
 Point (const GdkPoint &other)
 
bool operator== (const Point< value_type > &other) const
 
bool operator!= (const Point< value_type > &other) const
 
Point< value_type > & operator+= (const Point< value_type > &other)
 
Point< value_type > & operator-= (const Point< value_type > &other)
 
Point< value_type > & operator*= (value_type other)
 
Point< value_type > & operator*= (const Point< value_type > &other)
 
Point< value_type > & operator/= (value_type other)
 
Point< value_type > & operator/= (const Point< value_type > &other)
 
Point< value_typeoperator- () const
 
double magnitude () const
 
template<typename U >
Point< U > to () const
 
GdkPoint toGdkPoint () const
 

Public Attributes

value_type x {0}
 
value_type y {0}
 

Member Typedef Documentation

◆ value_type

template<typename T >
using Scroom::Utils::Point< T >::value_type = T

Constructor & Destructor Documentation

◆ Point() [1/5]

template<typename T >
Scroom::Utils::Point< T >::Point ( )
default

◆ Point() [2/5]

template<typename T >
Scroom::Utils::Point< T >::Point ( value_type  xy)
inlineexplicit
35  : Point(xy, xy)
36  {
37  }

◆ Point() [3/5]

template<typename T >
Scroom::Utils::Point< T >::Point ( value_type  x_,
value_type  y_ 
)
inline
40  : x(x_)
41  , y(y_)
42  {
43  }

◆ Point() [4/5]

template<typename T >
template<typename U >
Scroom::Utils::Point< T >::Point ( Point< U >  other)
inlineexplicit
47  : x(other.x)
48  , y(other.y)
49  {
50  }

◆ Point() [5/5]

template<typename T >
Scroom::Utils::Point< T >::Point ( const GdkPoint< T > &  other)
inlineexplicit
53  : x(other.x)
54  , y(other.y)
55  {
56  }

Member Function Documentation

◆ magnitude()

template<typename T >
double Scroom::Utils::Point< T >::magnitude ( ) const
inline
100 { return sqrt(x * x + y * y); }

◆ operator!=()

template<typename T >
bool Scroom::Utils::Point< T >::operator!= ( const Point< value_type > &  other) const
inline
59 { return !(*this == other); }

◆ operator*=() [1/2]

template<typename T >
Point<value_type>& Scroom::Utils::Point< T >::operator*= ( const Point< value_type > &  other)
inline
78  {
79  x *= other.x;
80  y *= other.y;
81  return *this;
82  }

◆ operator*=() [2/2]

template<typename T >
Point<value_type>& Scroom::Utils::Point< T >::operator*= ( value_type  other)
inline
71  {
72  x *= other;
73  y *= other;
74  return *this;
75  }

◆ operator+=()

template<typename T >
Point<value_type>& Scroom::Utils::Point< T >::operator+= ( const Point< value_type > &  other)
inline
62  {
63  x += other.x;
64  y += other.y;
65  return *this;
66  }

◆ operator-()

template<typename T >
Point<value_type> Scroom::Utils::Point< T >::operator- ( ) const
inline
98 { return Point<value_type>(-x, -y); }

◆ operator-=()

template<typename T >
Point<value_type>& Scroom::Utils::Point< T >::operator-= ( const Point< value_type > &  other)
inline
68 { return *this += -other; }

◆ operator/=() [1/2]

template<typename T >
Point<value_type>& Scroom::Utils::Point< T >::operator/= ( const Point< value_type > &  other)
inline
92  {
93  x /= other.x;
94  y /= other.y;
95  return *this;
96  }

◆ operator/=() [2/2]

template<typename T >
Point<value_type>& Scroom::Utils::Point< T >::operator/= ( value_type  other)
inline
85  {
86  x /= other;
87  y /= other;
88  return *this;
89  }

◆ operator==()

template<typename T >
bool Scroom::Utils::Point< T >::operator== ( const Point< value_type > &  other) const
inline
58 { return x == other.x && y == other.y; }

◆ to()

template<typename T >
template<typename U >
Point<U> Scroom::Utils::Point< T >::to ( ) const
inline
104  {
105  return {static_cast<U>(x), static_cast<U>(y)};
106  }

Referenced by TweakPositionTextBox::display(), View::on_zoombox_changed(), TweakPositionTextBox::parse(), View::redraw(), View::setPresentation(), and TweakRulers::tweakRulers().

Here is the caller graph for this function:

◆ toGdkPoint()

template<typename T >
GdkPoint Scroom::Utils::Point< T >::toGdkPoint ( ) const
inline
108 { return {static_cast<int>(x), static_cast<int>(y)}; }

Member Data Documentation

◆ x

◆ y


The documentation for this class was generated from the following file:
Scroom::Utils::Point::x
value_type x
Definition: point.hh:111
Scroom::Utils::Point::y
value_type y
Definition: point.hh:112
Scroom::Utils::Point::Point
Point()=default