Symphony Of Empires
Eng3D::Rectangle Struct Reference

#include <rectangle.hpp>

Public Member Functions

constexpr Rectangle ()=default
 
constexpr Rectangle (float x, float y, float width, float height)
 
constexpr Rectangle (glm::vec2 position, glm::vec2 size)
 
 ~Rectangle ()=default
 
constexpr float width () const
 Obtains the width. More...
 
constexpr float height () const
 Obtains the height. More...
 
constexpr glm::vec2 size () const
 Obtains the current size of the rectangle. More...
 
constexpr void size (glm::vec2 size)
 Sets the size of the rectangle. More...
 
template<typename T >
constexpr void size (T x, T y)
 
constexpr glm::vec2 position () const
 Obtains the current position of the rectangle. More...
 
constexpr void position (glm::vec2 position)
 Sets the base position of the rectangle, modifying it's size. More...
 
template<typename T >
constexpr void position (T x, T y)
 
constexpr void scale (glm::vec2 factor)
 Scales the rectangle by factor. More...
 
template<typename T >
constexpr void scale (T x, T y)
 
constexpr void offset (glm::vec2 offset)
 Offset the rectangle by the given parameter. More...
 
template<typename T >
constexpr void offset (T x, T y)
 
constexpr bool contains (glm::vec2 pos) const
 Checks if the point is contains the point. More...
 
template<typename T >
constexpr bool contains (T x, T y) const
 
constexpr bool contains (const Rectangle &rect) const
 Checks if the rectangle is contains the rectangle. More...
 
constexpr Rectangle intersection (const Rectangle &rect) const
 Obtains the intersection rectangle from two other rectangles R1 and R2. More...
 
constexpr Rectangle join (const Rectangle &rect) const
 Obtains the intersection rectangle from two other rectangles R1 and R2. More...
 

Public Attributes

float left = 0.f
 
float top = 0.f
 
float right = 0.f
 
float bottom = 0.f
 

Detailed Description

Definition at line 31 of file rectangle.hpp.

Constructor & Destructor Documentation

◆ Rectangle() [1/3]

constexpr Eng3D::Rectangle::Rectangle ( )
constexprdefault

◆ Rectangle() [2/3]

constexpr Eng3D::Rectangle::Rectangle ( float  x,
float  y,
float  width,
float  height 
)
inlineconstexpr

Definition at line 34 of file rectangle.hpp.

◆ Rectangle() [3/3]

constexpr Eng3D::Rectangle::Rectangle ( glm::vec2  position,
glm::vec2  size 
)
inlineconstexpr

Definition at line 43 of file rectangle.hpp.

◆ ~Rectangle()

Eng3D::Rectangle::~Rectangle ( )
default

Member Function Documentation

◆ contains() [1/3]

constexpr bool Eng3D::Rectangle::contains ( const Rectangle rect) const
inlineconstexpr

Checks if the rectangle is contains the rectangle.

Parameters
rectRectangle to check (rectangle must be inside this rectangle)
Returns
true Rectangle not in bounds
false Rectangle is in bounds

Definition at line 147 of file rectangle.hpp.

Here is the call graph for this function:

◆ contains() [2/3]

constexpr bool Eng3D::Rectangle::contains ( glm::vec2  pos) const
inlineconstexpr

Checks if the point is contains the point.

Parameters
posPosition to check (rectangle must cover this point)
Returns
true Rectangle not in bounds
false Rectangle is in bounds

Definition at line 134 of file rectangle.hpp.

Here is the caller graph for this function:

◆ contains() [3/3]

template<typename T >
constexpr bool Eng3D::Rectangle::contains ( x,
y 
) const
inlineconstexpr

Definition at line 139 of file rectangle.hpp.

Here is the call graph for this function:

◆ height()

constexpr float Eng3D::Rectangle::height ( ) const
inlineconstexpr

Obtains the height.

Returns
float Height of the rectangle

Definition at line 62 of file rectangle.hpp.

Here is the caller graph for this function:

◆ intersection()

constexpr Rectangle Eng3D::Rectangle::intersection ( const Rectangle rect) const
inlineconstexpr

Obtains the intersection rectangle from two other rectangles R1 and R2.

Parameters
rectSecond rectangle to perform the intersection for
Returns
Rectangle Intersection area rectangle

Definition at line 157 of file rectangle.hpp.

◆ join()

constexpr Rectangle Eng3D::Rectangle::join ( const Rectangle rect) const
inlineconstexpr

Obtains the intersection rectangle from two other rectangles R1 and R2.

Parameters
rectSecond rectangle to perform the intersection for
Returns
Rectangle Intersection area rectangle

Definition at line 168 of file rectangle.hpp.

◆ offset() [1/2]

constexpr void Eng3D::Rectangle::offset ( glm::vec2  offset)
inlineconstexpr

Offset the rectangle by the given parameter.

Parameters
offsetOffset to apply to the rectangle

Definition at line 118 of file rectangle.hpp.

Here is the caller graph for this function:

◆ offset() [2/2]

template<typename T >
constexpr void Eng3D::Rectangle::offset ( x,
y 
)
inlineconstexpr

Definition at line 126 of file rectangle.hpp.

Here is the call graph for this function:

◆ position() [1/3]

constexpr glm::vec2 Eng3D::Rectangle::position ( ) const
inlineconstexpr

Obtains the current position of the rectangle.

Returns
glm::vec2 The base position

Definition at line 86 of file rectangle.hpp.

Here is the caller graph for this function:

◆ position() [2/3]

constexpr void Eng3D::Rectangle::position ( glm::vec2  position)
inlineconstexpr

Sets the base position of the rectangle, modifying it's size.

Parameters
positionPosition to set

Definition at line 92 of file rectangle.hpp.

Here is the call graph for this function:

◆ position() [3/3]

template<typename T >
constexpr void Eng3D::Rectangle::position ( x,
y 
)
inlineconstexpr

Definition at line 98 of file rectangle.hpp.

Here is the call graph for this function:

◆ scale() [1/2]

constexpr void Eng3D::Rectangle::scale ( glm::vec2  factor)
inlineconstexpr

Scales the rectangle by factor.

Parameters
factorFactor to scale rectangle by

Definition at line 104 of file rectangle.hpp.

Here is the caller graph for this function:

◆ scale() [2/2]

template<typename T >
constexpr void Eng3D::Rectangle::scale ( x,
y 
)
inlineconstexpr

Definition at line 112 of file rectangle.hpp.

Here is the call graph for this function:

◆ size() [1/3]

constexpr glm::vec2 Eng3D::Rectangle::size ( ) const
inlineconstexpr

Obtains the current size of the rectangle.

Returns
glm::vec2 The size of the rectangle

Definition at line 68 of file rectangle.hpp.

Here is the caller graph for this function:

◆ size() [2/3]

constexpr void Eng3D::Rectangle::size ( glm::vec2  size)
inlineconstexpr

Sets the size of the rectangle.

Parameters
sizeSize to set it to

Definition at line 74 of file rectangle.hpp.

Here is the call graph for this function:

◆ size() [3/3]

template<typename T >
constexpr void Eng3D::Rectangle::size ( x,
y 
)
inlineconstexpr

Definition at line 80 of file rectangle.hpp.

Here is the call graph for this function:

◆ width()

constexpr float Eng3D::Rectangle::width ( ) const
inlineconstexpr

Obtains the width.

Returns
float Width of the rectangle

Definition at line 56 of file rectangle.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ bottom

float Eng3D::Rectangle::bottom = 0.f

Definition at line 32 of file rectangle.hpp.

◆ left

float Eng3D::Rectangle::left = 0.f

Definition at line 32 of file rectangle.hpp.

◆ right

float Eng3D::Rectangle::right = 0.f

Definition at line 32 of file rectangle.hpp.

◆ top

float Eng3D::Rectangle::top = 0.f

Definition at line 32 of file rectangle.hpp.


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