Rebel Fork Framework
Urho3D::Rect Class Reference

#include <Urho3D/Math/Rect.h>

Public Member Functions

 Rect () noexcept
 Construct an undefined rect.
 Rect (const Vector2 &min, const Vector2 &max) noexcept
 Construct from minimum and maximum vectors.
 Rect (float left, float top, float right, float bottom) noexcept
 Construct from coordinates.
 Rect (const Vector4 &vector) noexcept
 Construct from a Vector4.
 Rect (const float data[]) noexcept
 Construct from a float array.
 Rect (const Rect &rect) noexcept=default
 Copy-construct from another rect.
Rect & operator= (const Rect &rhs) noexcept=default
 Assign from another rect.
bool operator== (const Rect &rhs) const
 Test for equality with another rect.
bool operator!= (const Rect &rhs) const
 Test for inequality with another rect.
Rect & operator+= (const Rect &rhs)
 Add another rect to this one inplace.
Rect & operator-= (const Rect &rhs)
 Subtract another rect from this one inplace.
Rect & operator/= (float value)
 Divide by scalar inplace.
Rect & operator*= (float value)
 Multiply by scalar inplace.
Rect operator/ (float value) const
 Divide by scalar.
Rect operator* (float value) const
 Multiply by scalar.
Rect operator+ (const Rect &rhs) const
 Add another rect.
Rect operator- (const Rect &rhs) const
 Subtract another rect.
void Define (const Rect &rect)
 Define from another rect.
void Define (const Vector2 &min, const Vector2 &max)
 Define from minimum and maximum vectors.
void Define (const Vector2 &point)
 Define from a point.
void Merge (const Vector2 &point)
 Merge a point.
void Merge (const Rect &rect)
 Merge a rect.
void Clear ()
 Clear to undefined state.
void Clip (const Rect &rect)
 Clip with another rect.
bool Defined () const
 Return true if this rect is defined via a previous call to Define() or Merge().
Vector2 Center () const
Vector2 Size () const
Vector2 HalfSize () const
bool Equals (const Rect &rhs) const
 Test for equality with another rect with epsilon.
Intersection IsInside (const Vector2 &point) const
 Test whether a point is inside.
Intersection IsInside (const Rect &rect) const
 Test if another rect is inside, outside or intersects.
const float * Data () const
 Return float data.
Vector4 ToVector4 () const
 Return as a vector.
ea::string ToString () const
 Return as string.
unsigned ToHash () const
 Return hash value for HashSet & HashMap.
Vector2 Min () const
 Return left-top corner position.
Vector2 Max () const
 Return right-bottom corner position.
float Left () const
float Top () const
float Right () const
float Bottom () const

Public Attributes

Vector2 min_
 Minimum vector.
Vector2 max_
 Maximum vector.

Static Public Attributes

static const Rect FULL
 Rect in the range (-1, -1) - (1, 1).
static const Rect POSITIVE
 Rect in the range (0, 0) - (1, 1).
static const Rect ZERO
 Zero-sized rect.

Detailed Description

Two-dimensional bounding rectangle.

Member Function Documentation

◆ Bottom()

float Urho3D::Rect::Bottom ( ) const
inline

Return bottom coordinate.

◆ Center()

Vector2 Urho3D::Rect::Center ( ) const
inline

Return center.

◆ HalfSize()

Vector2 Urho3D::Rect::HalfSize ( ) const
inline

Return half-size.

◆ Left()

float Urho3D::Rect::Left ( ) const
inline

Return left coordinate.

◆ Right()

float Urho3D::Rect::Right ( ) const
inline

Return right coordinate.

◆ Size()

Vector2 Urho3D::Rect::Size ( ) const
inline

Return size.

◆ Top()

float Urho3D::Rect::Top ( ) const
inline

Return top coordinate.


The documentation for this class was generated from the following files:
  • Urho3D/Math/Rect.h
  • Urho3D/Math/Rect.cpp