Louvre  v2.13.0-1
C++ library for Wayland compositors
Public Member Functions | List of all members
LPointTemplate< T > Class Template Reference

Template for 2D vectors. More...

Public Member Functions

constexpr LPointTemplate () noexcept
 Initializes the vector with (0,0). More...
 
constexpr LPointTemplate (T x, T y) noexcept
 Initializes the vector with (x,y). More...
 
constexpr LPointTemplate (T n) noexcept
 Initializes the vector with (n,n). More...
 
template<class N >
constexpr LPointTemplate (const LPointTemplate< N > &point) noexcept
 Copy constructor. More...
 
constexpr T x () const noexcept
 First component of the vector. More...
 
constexpr T y () const noexcept
 Second component of the vector. More...
 
constexpr T w () const noexcept
 First component of the vector (equivalent to x()) More...
 
constexpr T h () const noexcept
 Second component of the vector (equivalent to y()) More...
 
constexpr T width () const noexcept
 First component of the vector (equivalent to x()) More...
 
constexpr T height () const noexcept
 Second component of the vector (equivalent to y()) More...
 
constexpr T area () const noexcept
 Product of the components (x*y) More...
 
constexpr void setX (T x) noexcept
 Assigns the value to the first component of the vector. More...
 
constexpr void setY (T y) noexcept
 Assigns the value to the second component of the vector. More...
 
constexpr void setW (T x) noexcept
 Assigns the value to the first component of the vector (equivalent to setX()) More...
 
constexpr void setH (T y) noexcept
 Assigns the value to the second component of the vector (equivalent to setY()) More...
 
constexpr void setWidth (T x) noexcept
 Assigns the value to the first component of the vector (equivalent to setX()) More...
 
constexpr void setHeight (T y) noexcept
 Assigns the value to the second component of the vector (equivalent to setY()) More...
 
template<class N >
constexpr LPointTemplate< T > constrainedToHeight (N size) const noexcept
 Assigns the second component while maintaining proportion with the first. More...
 
template<class N >
constexpr T distanceFrom (const LPointTemplate< N > &point) const noexcept
 Distance from another point. More...
 

Detailed Description

template<class T>
class Louvre::LPointTemplate< T >

Template for 2D vectors.

The LPointTemplate class is a template for creating two-dimensional vectors.
The library uses this template to generate the LPoint and LSize classes, which work with 32-bit integers, and LPointF and LSizeF, which work with 32-bit floating-point numbers.

Constructor & Destructor Documentation

◆ LPointTemplate() [1/4]

constexpr LPointTemplate ( )
inlineconstexprnoexcept

Initializes the vector with (0,0).

◆ LPointTemplate() [2/4]

constexpr LPointTemplate ( x,
y 
)
inlineconstexprnoexcept

Initializes the vector with (x,y).

◆ LPointTemplate() [3/4]

constexpr LPointTemplate ( n)
inlineconstexprnoexcept

Initializes the vector with (n,n).

◆ LPointTemplate() [4/4]

constexpr LPointTemplate ( const LPointTemplate< N > &  point)
inlineconstexprnoexcept

Copy constructor.

Member Function Documentation

◆ x()

constexpr T x ( ) const
inlineconstexprnoexcept

First component of the vector.

◆ y()

constexpr T y ( ) const
inlineconstexprnoexcept

Second component of the vector.

◆ w()

constexpr T w ( ) const
inlineconstexprnoexcept

First component of the vector (equivalent to x())

◆ h()

constexpr T h ( ) const
inlineconstexprnoexcept

Second component of the vector (equivalent to y())

◆ width()

constexpr T width ( ) const
inlineconstexprnoexcept

First component of the vector (equivalent to x())

◆ height()

constexpr T height ( ) const
inlineconstexprnoexcept

Second component of the vector (equivalent to y())

◆ area()

constexpr T area ( ) const
inlineconstexprnoexcept

Product of the components (x*y)

◆ setX()

constexpr void setX ( x)
inlineconstexprnoexcept

Assigns the value to the first component of the vector.

◆ setY()

constexpr void setY ( y)
inlineconstexprnoexcept

Assigns the value to the second component of the vector.

◆ setW()

constexpr void setW ( x)
inlineconstexprnoexcept

Assigns the value to the first component of the vector (equivalent to setX())

◆ setH()

constexpr void setH ( y)
inlineconstexprnoexcept

Assigns the value to the second component of the vector (equivalent to setY())

◆ setWidth()

constexpr void setWidth ( x)
inlineconstexprnoexcept

Assigns the value to the first component of the vector (equivalent to setX())

◆ setHeight()

constexpr void setHeight ( y)
inlineconstexprnoexcept

Assigns the value to the second component of the vector (equivalent to setY())

◆ constrainedToHeight()

constexpr LPointTemplate<T> constrainedToHeight ( size) const
inlineconstexprnoexcept

Assigns the second component while maintaining proportion with the first.

◆ distanceFrom()

constexpr T distanceFrom ( const LPointTemplate< N > &  point) const
inlineconstexprnoexcept

Distance from another point.