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

/** 
* Concstruct RectangleF objects
*/
RectangleF();
RectangleF(Vector2f position, Vector2f size);
RectangleF(float x, float y, float width, float height);
RectangleF(const RectangleF&);

Operators

/** 
* Assignment operator.
*/
RectangleF& operator=(const RectangleF&)
/**
* Compare operators.
*/
bool operator==(const RectangleF& a, const RectangleF& b);
bool operator!=(const RectangleF& a, const RectangleF& b);

Methods

/**
* Origin of the rectangle.
*/ 
const Vector2f& position(); 
Vector2f& position();
/**
* Size of the rectangle.
*/
const Vector2f& size(); 
Vector2f& size();
/**
* X of the origin of the rectangle.
*/
float x() const; 
float& x();
/** 
* Y of the origin of the rectangle.
*/
float y() const; 
float& y();
/**
* Width of the rectangle.
*/
float width() const; 
float& width();
/**
* height of the rectangle.
*/
float height() const; 
float& height();
/**
* Min/max X/Y coordinates of the rectangle.
*/
float left() const;
float right() const;
float top() const;
float bottom() const;
/**
* Check if a point or rectangle is completely inside of this rectangle.
*/
bool contains(const Vector2i& point);
bool contains(const RectangleF& dest);
/**
* Check if the rectangle is empty (which means width() < epsilon && height() < epsilon)
*/
bool empty();
/**
* Calculate union of current and reference rectangles.
*/
void unionOf(const RectangleF& dest);

/**
* Calculate intersection of current and reference rectangles.
*/
void intersectionOf(const RectangleF & dest);

/**
* Calculate area of the rectangle.
*/
float area() const;