Skip to main content

Rect

The Rect struct defines a rectangle with properties for the left, right, bottom, and top coordinates, and provides various methods to manipulate and query the rectangle.

#include <interface/TellusimTypes.h>

Constructors

Rect()
explicit Rect(float32_t value)
Rect(float32_t horizontal, float32_t vertical)
Rect(float32_t left, float32_t right, float32_t bottom, float32_t top)

Methods

Check rectangle.

bool isValid() const
operator bool() const

Expand by point.

Rect &expand(float32_t x, float32_t y)

Expand by rectangle.

Rect &expand(const Rect &rect)

Shrink by rectangle.

Rect &shrink(const Rect &rect)

Inside point.

bool inside(float32_t x, float32_t y) const
bool inside(const Vector2f &v) const
bool inside(const Rect &rect) const

Rectangle size.

Vector2f getSize() const
float32_t getWidth() const
float32_t getHeight() const

Center of rectangle.

Vector2f getCenter() const
float32_t getCenterX() const
float32_t getCenterY() const

Rectangle to vector operators.

Rect &operator+=(const Vector2f &v)
Rect &operator-=(const Vector2f &v)

Rectangle to rectangle operators.

Rect &operator+=(const Rect &r)
Rect &operator-=(const Rect &r)

Operators

Rectangle to scalar operators.

Rect operator*(const Rect &r, float32_t s)
Rect operator/(const Rect &r, float32_t s)

Rectangle to vector operators.

Rect operator*(const Rect &r, const Vector2f &v)
Rect operator/(const Rect &r, const Vector2f &v)
Rect operator+(const Rect &r, const Vector2f &v)
Rect operator-(const Rect &r, const Vector2f &v)

Rectangle to rectangle operators.

Rect operator+(const Rect &r0, const Rect &r1)
Rect operator-(const Rect &r0, const Rect &r1)

Matrix to rectangle multiplication.

template<> Rect operator*(const Matrix4x4<Type> &m, const Rect &r)