Saga3D API Documentation
1.0-RC4
|
Go to the documentation of this file.
5 #ifndef __IRR_RECT_H_INCLUDED__
6 #define __IRR_RECT_H_INCLUDED__
8 #include <glm/vec2.hpp>
36 rect(
const glm::vec2& upperLeft,
const glm::vec2& lowerRight)
41 rect(
const glm::vec2& pos,
const glm::vec2& size)
46 explicit rect(
const glm::vec2& size)
void addInternalPoint(T x, T y)
Adds a point to the bounding rectangle.
rect< float > rectf
Rectangle with float values.
T getArea() const
Returns size of rectangle.
glm::vec2 getCenter() const
Get the center of the rectangle.
bool operator!=(const rect< T > &other) const
inequality operator
rect()
Default constructor creating empty rectangle at (0,0)
rect(const glm::vec2 &pos, const glm::vec2 &size)
Constructor with upper left corner and dimension.
bool operator<(const rect< T > &other) const
compares size of rectangles
void addInternalPoint(const glm::vec2 &p)
Adds a point to the rectangle.
rect< T > operator+(const glm::vec2 &pos) const
move right by given numbers
rect< T > operator-(const glm::vec2 &pos) const
move left by given numbers
void clipAgainst(const rect< T > &other)
Clips this rectangle with another one.
void repair()
If the lower right corner of the rect is smaller then the upper left, the points are swapped.
bool isPointInside(const glm::vec2 &pos) const
Returns if a 2d point is within this rectangle.
T getWidth() const
Get width of rectangle.
rect< T > & operator+=(const glm::vec2 &pos)
move right by given numbers
glm::vec2 getSize() const
Get the dimensions of the rectangle.
rect< std::int32_t > recti
Rectangle with int values.
rect< T > & operator-=(const glm::vec2 &pos)
move left by given numbers
rect(const glm::vec2 &size)
Constructor with upper left at 0,0 and lower right using dimension.
T getHeight() const
Get height of rectangle.
rect(T x, T y, T x2, T y2)
Constructor with two corners.
bool isValid() const
Returns if the rect is valid to draw.
bool constrainTo(const rect< T > &other)
Moves this rectangle to fit inside another one.
rect(const glm::vec2 &upperLeft, const glm::vec2 &lowerRight)
Constructor with two corners.
glm::vec2 UpperLeftCorner
Upper left corner.
glm::vec2 LowerRightCorner
Lower right corner.
bool operator==(const rect< T > &other) const
equality operator
bool isRectCollided(const rect< T > &other) const
Check if the rectangle collides with another rectangle.