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

Template for 4D vectors. More...

Public Member Functions

constexpr LRectTemplate () noexcept
 Initializes the vector with (0,0,0,0). More...
 
constexpr LRectTemplate (T x, T y, T width, T height) noexcept
 Initializes the vector with (x,y,width,height). More...
 
template<class NA , class NB >
constexpr LRectTemplate (const LPointTemplate< NA > &topLeft, const LPointTemplate< NB > &bottomRight) noexcept
 Initializes the vector with (topLeft.x(),topLeft.y(),bottomRight.x(),bottomRight.y()). More...
 
template<class N >
constexpr LRectTemplate (T topLeft, const LPointTemplate< N > &bottomRight) noexcept
 Initializes the vector with (topLeft.x(),topLeft.y(),bottomRight.x(),bottomRight.y()). More...
 
template<class N >
constexpr LRectTemplate (const LPointTemplate< N > &topLeft, T bottomRight) noexcept
 Initializes the vector with (topLeft.x(),topLeft.y(),bottomRight.x(),bottomRight.y()). More...
 
constexpr LRectTemplate (T all) noexcept
 Initializes the vector with (all,all,all,all). More...
 
template<class N >
constexpr LRectTemplate (const LPointTemplate< N > &p) noexcept
 Initializes the vector with (p.x(),p.y(),p.x(),p.y()). More...
 
template<class N >
constexpr LRectTemplate (const LRectTemplate< N > &r) noexcept
 Copy constructor. More...
 
constexpr T x () const noexcept
 First vector component. More...
 
constexpr T y () const noexcept
 Second vector component. More...
 
constexpr T w () const noexcept
 Third vector component. More...
 
constexpr T h () const noexcept
 Fourth vector component. More...
 
constexpr T width () const noexcept
 Third vector component. More...
 
constexpr T height () const noexcept
 Fourth vector component. More...
 
constexpr T area () const noexcept
 The multiplication of the third and fourth component (width*height) More...
 
template<class N >
constexpr bool containsPoint (const LPointTemplate< N > &point, bool inclusive=true) const noexcept
 
template<class N >
constexpr bool intersects (const LRectTemplate< N > &rect, bool inclusive=true) const noexcept
 
constexpr const LPointTemplate< T > & topLeft () const noexcept
 2D vector given by the (x,y) components of the rectangle More...
 
constexpr const LPointTemplate< T > & bottomRight () const noexcept
 2D vector given by the (w,h) components of the rectangle More...
 
constexpr const LPointTemplate< T > & TL () const noexcept
 2D vector given by the (x,y) components of the rectangle More...
 
constexpr const LPointTemplate< T > & BR () const noexcept
 2D vector given by the (w,h) components of the rectangle More...
 
constexpr const LPointTemplate< T > & pos () const noexcept
 2D vector given by the (x,y) components of the rectangle More...
 
constexpr const LPointTemplate< T > & size () const noexcept
 2D vector given by the (w,h) components of the rectangle More...
 
constexpr void setX (T x) noexcept
 Asigns the first component. More...
 
constexpr void setY (T y) noexcept
 Asigns the second component. More...
 
constexpr void setW (T width) noexcept
 Asigns the third component. More...
 
constexpr void setH (T height) noexcept
 Asigns the fourth component. More...
 
constexpr void setWidth (T width) noexcept
 Asigns the third component. More...
 
constexpr void setHeight (T height) noexcept
 Asigns the fourth component. More...
 
constexpr void setTL (const LPointTemplate< T > &p) noexcept
 Asigns the (x,y) components. More...
 
constexpr void setBR (const LPointTemplate< T > &p) noexcept
 Asigns the (w,h) components. More...
 
constexpr void setTopLeft (const LPointTemplate< T > &p) noexcept
 Asigns the (x,y) components. More...
 
constexpr void setBottomRight (const LPointTemplate< T > &p) noexcept
 Asigns the (w,h) components. More...
 
constexpr void setPos (const LPointTemplate< T > &p) noexcept
 Asigns the (x,y) components. More...
 
constexpr void setSize (const LPointTemplate< T > &p) noexcept
 Asigns the (w,h) components. More...
 
template<class N >
constexpr bool clip (const LRectTemplate< N > &rect) noexcept
 Returns true if the resulting rectangle has an area of 0. More...
 

Detailed Description

template<class T>
class Louvre::LRectTemplate< T >

Template for 4D vectors.

The LRectTemplate class is a template for creating four-dimensional vectors.
The library uses this template to generate the classes LRect which works with 32-bit integers and LRectF which works with 32-bit floats.

Constructor & Destructor Documentation

◆ LRectTemplate() [1/8]

constexpr LRectTemplate ( )
inlineconstexprnoexcept

Initializes the vector with (0,0,0,0).

◆ LRectTemplate() [2/8]

constexpr LRectTemplate ( x,
y,
width,
height 
)
inlineconstexprnoexcept

Initializes the vector with (x,y,width,height).

◆ LRectTemplate() [3/8]

constexpr LRectTemplate ( const LPointTemplate< NA > &  topLeft,
const LPointTemplate< NB > &  bottomRight 
)
inlineconstexprnoexcept

Initializes the vector with (topLeft.x(),topLeft.y(),bottomRight.x(),bottomRight.y()).

◆ LRectTemplate() [4/8]

constexpr LRectTemplate ( topLeft,
const LPointTemplate< N > &  bottomRight 
)
inlineconstexprnoexcept

Initializes the vector with (topLeft.x(),topLeft.y(),bottomRight.x(),bottomRight.y()).

◆ LRectTemplate() [5/8]

constexpr LRectTemplate ( const LPointTemplate< N > &  topLeft,
bottomRight 
)
inlineconstexprnoexcept

Initializes the vector with (topLeft.x(),topLeft.y(),bottomRight.x(),bottomRight.y()).

◆ LRectTemplate() [6/8]

constexpr LRectTemplate ( all)
inlineconstexprnoexcept

Initializes the vector with (all,all,all,all).

◆ LRectTemplate() [7/8]

constexpr LRectTemplate ( const LPointTemplate< N > &  p)
inlineconstexprnoexcept

Initializes the vector with (p.x(),p.y(),p.x(),p.y()).

◆ LRectTemplate() [8/8]

constexpr LRectTemplate ( const LRectTemplate< N > &  r)
inlineconstexprnoexcept

Copy constructor.

Member Function Documentation

◆ x()

constexpr T x ( ) const
inlineconstexprnoexcept

First vector component.

◆ y()

constexpr T y ( ) const
inlineconstexprnoexcept

Second vector component.

◆ w()

constexpr T w ( ) const
inlineconstexprnoexcept

Third vector component.

◆ h()

constexpr T h ( ) const
inlineconstexprnoexcept

Fourth vector component.

◆ width()

constexpr T width ( ) const
inlineconstexprnoexcept

Third vector component.

◆ height()

constexpr T height ( ) const
inlineconstexprnoexcept

Fourth vector component.

◆ area()

constexpr T area ( ) const
inlineconstexprnoexcept

The multiplication of the third and fourth component (width*height)

◆ containsPoint()

constexpr bool containsPoint ( const LPointTemplate< N > &  point,
bool  inclusive = true 
) const
inlineconstexprnoexcept

Returns true if the rectangle contains the point.

Parameters
pointThe 2D vector to check
inclusiveIf true, the edges of the rectangle are considered as part of the rectangle.

◆ intersects()

constexpr bool intersects ( const LRectTemplate< N > &  rect,
bool  inclusive = true 
) const
inlineconstexprnoexcept

Returns true if the rectangles intersect.

Parameters
rectRectangle to intersect
inclusiveIf true, the edges of the rectangle are considered

◆ topLeft()

constexpr const LPointTemplate<T>& topLeft ( ) const
inlineconstexprnoexcept

2D vector given by the (x,y) components of the rectangle

◆ bottomRight()

constexpr const LPointTemplate<T>& bottomRight ( ) const
inlineconstexprnoexcept

2D vector given by the (w,h) components of the rectangle

◆ TL()

constexpr const LPointTemplate<T>& TL ( ) const
inlineconstexprnoexcept

2D vector given by the (x,y) components of the rectangle

◆ BR()

constexpr const LPointTemplate<T>& BR ( ) const
inlineconstexprnoexcept

2D vector given by the (w,h) components of the rectangle

◆ pos()

constexpr const LPointTemplate<T>& pos ( ) const
inlineconstexprnoexcept

2D vector given by the (x,y) components of the rectangle

◆ size()

constexpr const LPointTemplate<T>& size ( ) const
inlineconstexprnoexcept

2D vector given by the (w,h) components of the rectangle

◆ setX()

constexpr void setX ( x)
inlineconstexprnoexcept

Asigns the first component.

◆ setY()

constexpr void setY ( y)
inlineconstexprnoexcept

Asigns the second component.

◆ setW()

constexpr void setW ( width)
inlineconstexprnoexcept

Asigns the third component.

◆ setH()

constexpr void setH ( height)
inlineconstexprnoexcept

Asigns the fourth component.

◆ setWidth()

constexpr void setWidth ( width)
inlineconstexprnoexcept

Asigns the third component.

◆ setHeight()

constexpr void setHeight ( height)
inlineconstexprnoexcept

Asigns the fourth component.

◆ setTL()

constexpr void setTL ( const LPointTemplate< T > &  p)
inlineconstexprnoexcept

Asigns the (x,y) components.

◆ setBR()

constexpr void setBR ( const LPointTemplate< T > &  p)
inlineconstexprnoexcept

Asigns the (w,h) components.

◆ setTopLeft()

constexpr void setTopLeft ( const LPointTemplate< T > &  p)
inlineconstexprnoexcept

Asigns the (x,y) components.

◆ setBottomRight()

constexpr void setBottomRight ( const LPointTemplate< T > &  p)
inlineconstexprnoexcept

Asigns the (w,h) components.

◆ setPos()

constexpr void setPos ( const LPointTemplate< T > &  p)
inlineconstexprnoexcept

Asigns the (x,y) components.

◆ setSize()

constexpr void setSize ( const LPointTemplate< T > &  p)
inlineconstexprnoexcept

Asigns the (w,h) components.

◆ clip()

constexpr bool clip ( const LRectTemplate< N > &  rect)
inlineconstexprnoexcept

Returns true if the resulting rectangle has an area of 0.