Jet  v1.3.3
Public Member Functions | Public Attributes | List of all members
jet::Point< T, 2 > Class Template Reference

2-D point class. More...

#include <jet/point2.h>

Public Member Functions

constexpr Point ()
 Constructs default point (0, 0). More...
 
constexpr Point (T x_, T y_)
 Constructs point with given parameters x_ and y_. More...
 
template<typename U >
 Point (const std::initializer_list< U > &lst)
 Constructs point with initializer list. More...
 
constexpr Point (const Point &v)
 Copy constructor. More...
 
void set (T s)
 Set both x and y components to s. More...
 
void set (T x, T y)
 Set x and y components with given parameters. More...
 
template<typename U >
void set (const std::initializer_list< U > &lst)
 Set x and y components with given initializer list. More...
 
void set (const Point &pt)
 Set x and y with other point pt. More...
 
void setZero ()
 Set both x and y to zero. More...
 
Point add (T v) const
 Computes this + (v, v). More...
 
Point add (const Point &v) const
 Computes this + (v.x, v.y). More...
 
Point sub (T v) const
 Computes this - (v, v). More...
 
Point sub (const Point &v) const
 Computes this - (v.x, v.y). More...
 
Point mul (T v) const
 Computes this * (v, v). More...
 
Point mul (const Point &v) const
 Computes this * (v.x, v.y). More...
 
Point div (T v) const
 Computes this / (v, v). More...
 
Point div (const Point &v) const
 Computes this / (v.x, v.y). More...
 
Point rsub (T v) const
 Computes (v, v) - this. More...
 
Point rsub (const Point &v) const
 Computes (v.x, v.y) - this. More...
 
Point rdiv (T v) const
 Computes (v, v) / this. More...
 
Point rdiv (const Point &v) const
 Computes (v.x, v.y) / this. More...
 
void iadd (T v)
 Computes this += (v, v). More...
 
void iadd (const Point &v)
 Computes this += (v.x, v.y). More...
 
void isub (T v)
 Computes this -= (v, v). More...
 
void isub (const Point &v)
 Computes this -= (v.x, v.y). More...
 
void imul (T v)
 Computes this *= (v, v). More...
 
void imul (const Point &v)
 Computes this *= (v.x, v.y). More...
 
void idiv (T v)
 Computes this /= (v, v). More...
 
void idiv (const Point &v)
 Computes this /= (v.x, v.y). More...
 
const T & at (size_t i) const
 Returns const reference to the i -th element of the point. More...
 
T & at (size_t i)
 Returns reference to the i -th element of the point. More...
 
sum () const
 Returns the sum of all the components (i.e. x + y). More...
 
min () const
 Returns the minimum value among x and y. More...
 
max () const
 Returns the maximum value among x and y. More...
 
absmin () const
 Returns the absolute minimum value among x and y. More...
 
absmax () const
 Returns the absolute maximum value among x and y. More...
 
size_t dominantAxis () const
 Returns the index of the dominant axis. More...
 
size_t subminantAxis () const
 Returns the index of the subminant axis. More...
 
template<typename U >
Point< U, 2 > castTo () const
 Returns a point with different value type. More...
 
bool isEqual (const Point &other) const
 Returns true if other is the same as this point. More...
 
T & operator[] (size_t i)
 Returns reference to the i -th element of the point. More...
 
const T & operator[] (size_t i) const
 Returns const reference to the i -th element of the point. More...
 
Pointoperator= (const std::initializer_list< T > &lst)
 Set x and y components with given initializer list. More...
 
Pointoperator= (const Point &v)
 Set x and y with other point pt. More...
 
Pointoperator+= (T v)
 Computes this += (v, v) More...
 
Pointoperator+= (const Point &v)
 Computes this += (v.x, v.y) More...
 
Pointoperator-= (T v)
 Computes this -= (v, v) More...
 
Pointoperator-= (const Point &v)
 Computes this -= (v.x, v.y) More...
 
Pointoperator*= (T v)
 Computes this *= (v, v) More...
 
Pointoperator*= (const Point &v)
 Computes this *= (v.x, v.y) More...
 
Pointoperator/= (T v)
 Computes this /= (v, v) More...
 
Pointoperator/= (const Point &v)
 Computes this /= (v.x, v.y) More...
 
bool operator== (const Point &v) const
 Returns true if other is the same as this point. More...
 
bool operator!= (const Point &v) const
 Returns true if other is the not same as this point. More...
 

Public Attributes

x
 X (or the first) component of the point. More...
 
y
 Y (or the second) component of the point. More...
 

Detailed Description

template<typename T>
class jet::Point< T, 2 >

2-D point class.

This class defines simple 2-D point data.

Template Parameters
T- Type of the element

Constructor & Destructor Documentation

◆ Point() [1/4]

template<typename T >
constexpr jet::Point< T, 2 >::Point ( )
inlineconstexpr

Constructs default point (0, 0).

◆ Point() [2/4]

template<typename T >
constexpr jet::Point< T, 2 >::Point ( x_,
y_ 
)
inlineconstexpr

Constructs point with given parameters x_ and y_.

◆ Point() [3/4]

template<typename T >
template<typename U >
jet::Point< T, 2 >::Point ( const std::initializer_list< U > &  lst)

Constructs point with initializer list.

◆ Point() [4/4]

template<typename T >
constexpr jet::Point< T, 2 >::Point ( const Point< T, 2 > &  v)
inlineconstexpr

Copy constructor.

Member Function Documentation

◆ absmax()

template<typename T >
T jet::Point< T, 2 >::absmax ( ) const

Returns the absolute maximum value among x and y.

◆ absmin()

template<typename T >
T jet::Point< T, 2 >::absmin ( ) const

Returns the absolute minimum value among x and y.

◆ add() [1/2]

template<typename T >
Point jet::Point< T, 2 >::add ( const Point< T, 2 > &  v) const

Computes this + (v.x, v.y).

◆ add() [2/2]

template<typename T >
Point jet::Point< T, 2 >::add ( v) const

Computes this + (v, v).

◆ at() [1/2]

template<typename T >
T& jet::Point< T, 2 >::at ( size_t  i)

Returns reference to the i -th element of the point.

◆ at() [2/2]

template<typename T >
const T& jet::Point< T, 2 >::at ( size_t  i) const

Returns const reference to the i -th element of the point.

◆ castTo()

template<typename T >
template<typename U >
Point<U, 2> jet::Point< T, 2 >::castTo ( ) const

Returns a point with different value type.

◆ div() [1/2]

template<typename T >
Point jet::Point< T, 2 >::div ( const Point< T, 2 > &  v) const

Computes this / (v.x, v.y).

◆ div() [2/2]

template<typename T >
Point jet::Point< T, 2 >::div ( v) const

Computes this / (v, v).

◆ dominantAxis()

template<typename T >
size_t jet::Point< T, 2 >::dominantAxis ( ) const

Returns the index of the dominant axis.

◆ iadd() [1/2]

template<typename T >
void jet::Point< T, 2 >::iadd ( const Point< T, 2 > &  v)

Computes this += (v.x, v.y).

◆ iadd() [2/2]

template<typename T >
void jet::Point< T, 2 >::iadd ( v)

Computes this += (v, v).

◆ idiv() [1/2]

template<typename T >
void jet::Point< T, 2 >::idiv ( const Point< T, 2 > &  v)

Computes this /= (v.x, v.y).

◆ idiv() [2/2]

template<typename T >
void jet::Point< T, 2 >::idiv ( v)

Computes this /= (v, v).

◆ imul() [1/2]

template<typename T >
void jet::Point< T, 2 >::imul ( const Point< T, 2 > &  v)

Computes this *= (v.x, v.y).

◆ imul() [2/2]

template<typename T >
void jet::Point< T, 2 >::imul ( v)

Computes this *= (v, v).

◆ isEqual()

template<typename T >
bool jet::Point< T, 2 >::isEqual ( const Point< T, 2 > &  other) const

Returns true if other is the same as this point.

◆ isub() [1/2]

template<typename T >
void jet::Point< T, 2 >::isub ( const Point< T, 2 > &  v)

Computes this -= (v.x, v.y).

◆ isub() [2/2]

template<typename T >
void jet::Point< T, 2 >::isub ( v)

Computes this -= (v, v).

◆ max()

template<typename T >
T jet::Point< T, 2 >::max ( ) const

Returns the maximum value among x and y.

◆ min()

template<typename T >
T jet::Point< T, 2 >::min ( ) const

Returns the minimum value among x and y.

◆ mul() [1/2]

template<typename T >
Point jet::Point< T, 2 >::mul ( const Point< T, 2 > &  v) const

Computes this * (v.x, v.y).

◆ mul() [2/2]

template<typename T >
Point jet::Point< T, 2 >::mul ( v) const

Computes this * (v, v).

◆ operator!=()

template<typename T >
bool jet::Point< T, 2 >::operator!= ( const Point< T, 2 > &  v) const

Returns true if other is the not same as this point.

◆ operator*=() [1/2]

template<typename T >
Point& jet::Point< T, 2 >::operator*= ( const Point< T, 2 > &  v)

Computes this *= (v.x, v.y)

◆ operator*=() [2/2]

template<typename T >
Point& jet::Point< T, 2 >::operator*= ( v)

Computes this *= (v, v)

◆ operator+=() [1/2]

template<typename T >
Point& jet::Point< T, 2 >::operator+= ( const Point< T, 2 > &  v)

Computes this += (v.x, v.y)

◆ operator+=() [2/2]

template<typename T >
Point& jet::Point< T, 2 >::operator+= ( v)

Computes this += (v, v)

◆ operator-=() [1/2]

template<typename T >
Point& jet::Point< T, 2 >::operator-= ( const Point< T, 2 > &  v)

Computes this -= (v.x, v.y)

◆ operator-=() [2/2]

template<typename T >
Point& jet::Point< T, 2 >::operator-= ( v)

Computes this -= (v, v)

◆ operator/=() [1/2]

template<typename T >
Point& jet::Point< T, 2 >::operator/= ( const Point< T, 2 > &  v)

Computes this /= (v.x, v.y)

◆ operator/=() [2/2]

template<typename T >
Point& jet::Point< T, 2 >::operator/= ( v)

Computes this /= (v, v)

◆ operator=() [1/2]

template<typename T >
Point& jet::Point< T, 2 >::operator= ( const Point< T, 2 > &  v)

Set x and y with other point pt.

◆ operator=() [2/2]

template<typename T >
Point& jet::Point< T, 2 >::operator= ( const std::initializer_list< T > &  lst)

Set x and y components with given initializer list.

◆ operator==()

template<typename T >
bool jet::Point< T, 2 >::operator== ( const Point< T, 2 > &  v) const

Returns true if other is the same as this point.

◆ operator[]() [1/2]

template<typename T >
T& jet::Point< T, 2 >::operator[] ( size_t  i)

Returns reference to the i -th element of the point.

◆ operator[]() [2/2]

template<typename T >
const T& jet::Point< T, 2 >::operator[] ( size_t  i) const

Returns const reference to the i -th element of the point.

◆ rdiv() [1/2]

template<typename T >
Point jet::Point< T, 2 >::rdiv ( const Point< T, 2 > &  v) const

Computes (v.x, v.y) / this.

◆ rdiv() [2/2]

template<typename T >
Point jet::Point< T, 2 >::rdiv ( v) const

Computes (v, v) / this.

◆ rsub() [1/2]

template<typename T >
Point jet::Point< T, 2 >::rsub ( const Point< T, 2 > &  v) const

Computes (v.x, v.y) - this.

◆ rsub() [2/2]

template<typename T >
Point jet::Point< T, 2 >::rsub ( v) const

Computes (v, v) - this.

◆ set() [1/4]

template<typename T >
void jet::Point< T, 2 >::set ( const Point< T, 2 > &  pt)

Set x and y with other point pt.

◆ set() [2/4]

template<typename T >
template<typename U >
void jet::Point< T, 2 >::set ( const std::initializer_list< U > &  lst)

Set x and y components with given initializer list.

◆ set() [3/4]

template<typename T >
void jet::Point< T, 2 >::set ( s)

Set both x and y components to s.

◆ set() [4/4]

template<typename T >
void jet::Point< T, 2 >::set ( x,
y 
)

Set x and y components with given parameters.

◆ setZero()

template<typename T >
void jet::Point< T, 2 >::setZero ( )

Set both x and y to zero.

◆ sub() [1/2]

template<typename T >
Point jet::Point< T, 2 >::sub ( const Point< T, 2 > &  v) const

Computes this - (v.x, v.y).

◆ sub() [2/2]

template<typename T >
Point jet::Point< T, 2 >::sub ( v) const

Computes this - (v, v).

◆ subminantAxis()

template<typename T >
size_t jet::Point< T, 2 >::subminantAxis ( ) const

Returns the index of the subminant axis.

◆ sum()

template<typename T >
T jet::Point< T, 2 >::sum ( ) const

Returns the sum of all the components (i.e. x + y).

Member Data Documentation

◆ x

template<typename T >
T jet::Point< T, 2 >::x

X (or the first) component of the point.

◆ y

template<typename T >
T jet::Point< T, 2 >::y

Y (or the second) component of the point.


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