NAP
Public Member Functions | Public Attributes | List of all members
Rect Class Referencefinal

#include <rect.h>

Public Member Functions

constexpr Rect ()=default
 
constexpr Rect (float x, float y, float width, float height)
 
constexpr Rect (const glm::vec2 &min, const glm::vec2 &max)
 
constexpr Rect (glm::vec2 &&min, glm::vec2 &&max)
 
bool operator== (const Rect &other) const
 
bool operator!= (const Rect &other) const
 
float getWidth () const
 
float getHeight () const
 
bool hasWidth () const
 
bool hasHeight () const
 
bool inside (const glm::vec2 &point) const
 
const glm::vec2 & getMin () const
 
const glm::vec2 & getMax () const
 

Public Attributes

glm::vec2 mMinPosition = { 0.0f, 0.0f }
 
glm::vec2 mMaxPosition = { 0.0f, 0.0f }
 

Description

Simple 2D rectangle.

Constructor & Destructor Documentation

◆ Rect() [1/4]

constexpr Rect ( )
constexprdefault

Default constructor

◆ Rect() [2/4]

constexpr Rect ( float  x,
float  y,
float  width,
float  height 
)
constexpr

Utility constructor

Parameters
xthe start x position of the rectangle
ythe start y position of the rectangle
widththe width of the rectangle
heightthe height of the triangle

◆ Rect() [3/4]

constexpr Rect ( const glm::vec2 &  min,
const glm::vec2 &  max 
)
constexpr

Utility min max constructor

Parameters
minthe min x, y position of the rectangle
maxthe max x, y position of the rectangle

◆ Rect() [4/4]

constexpr Rect ( glm::vec2 &&  min,
glm::vec2 &&  max 
)
constexpr

Utility min max move constructor

Parameters
minthe min x, y position of the rectangle
maxthe max x, y position of the rectangle

Member Function Documentation

◆ getHeight()

float getHeight ( ) const
Returns
the absolute height of the rectangle

◆ getMax()

const glm::vec2& getMax ( ) const
Returns
the max rectangle coordinates

◆ getMin()

const glm::vec2& getMin ( ) const
Returns
the min rectangle coordinates

◆ getWidth()

float getWidth ( ) const
Returns
the absolute width of the rectangle

◆ hasHeight()

bool hasHeight ( ) const
Returns
if the rect has a height associated with it

◆ hasWidth()

bool hasWidth ( ) const
Returns
if the rect has a width associated with it

◆ inside()

bool inside ( const glm::vec2 &  point) const
Returns
if a point is inside the rectangle, this excludes the exact edge

◆ operator!=()

bool operator!= ( const Rect other) const

◆ operator==()

bool operator== ( const Rect other) const

Member Data Documentation

◆ mMaxPosition

glm::vec2 mMaxPosition = { 0.0f, 0.0f }

◆ mMinPosition

glm::vec2 mMinPosition = { 0.0f, 0.0f }