rpos::core::RectangleF Class

RectangleF denotes rectangle, which coordinates are all floats

Header File

rpos/core/detail/geometry_rectangle.h

Applies to

  • Slamware
  • Mapper

Constructors

RectangleF();
RectangleF(Vector2f position, Vector2f size);
RectangleF(float x, float y, float width, float height);
RectangleF(const RectangleF&)

Construct RectangleF objects

Operators

RectangleF& operator=(const RectangleF&)

Assignment operator

bool operator==(const RectangleF& a, const RectangleF& b);
bool operator!=(const RectangleF& a, const RectangleF& b);

Compare operators

Methods

const Vector2f& position(); Vector2f& position()

Origin of the rectangle

const Vector2f& size(); Vector2f& size()

Size of the rectangle

float x() const; float& x()

X of the origin of the rectangle

float y() const; float& y()

Y of the origin of the rectangle

float width() const; float& width()

Width of the rectangle

float height() const; float& height()

height of the rectangle

float left() const;
float right() const;
float top() const;
float bottom() const;

Min/max X/Y coordinates of the rectangle.

bool contains(const Vector2i& point)
bool contains(const RectangleF& dest)

Check if a point or rectangle is completely inside of this rectangle

bool empty()

Check if the rectangle is empty (which means width() < epsilon && height() < epsilon)

void unionOf(const RectangleF& dest);

Calculate union of current and reference rectangles:

void intersectionOf(const RectangleF & dest);

Calculate intersection of current and reference rectangles:

float area() const

Calculate area of the rectangle