Clementine
Public Member Functions | Public Attributes | List of all members
Rect2 Class Reference

二维矩形, 单精度. More...

#include <Rect2.h>

Collaboration diagram for Rect2:
Collaboration graph
[legend]

Public Member Functions

 Rect2 ()=default
 默认构造函数.
 
 Rect2 (const Point2 &origin, const Size2 &size)
 构造函数. More...
 
 Rect2 (float x, float y, float width, float height)
 构造函数. More...
 
float top () const
 获取上边的 y 坐标.
 
float bottom () const
 获取下底的 y 坐标.
 
float left () const
 获取左边的 x 坐标.
 
float right () const
 获取右边的 x 坐标.
 
Point2 tl () const
 获取左上角坐标.
 
Point2 tr () const
 获取右上角坐标.
 
Point2 bl () const
 获取左下角坐标.
 
Point2 br () const
 获取右下角坐标.
 
bool intersectsPoint (const Point2 &point) const
 检测是否与二维点发生相交. More...
 
bool intersectsRect (const Rect2 &rect) const
 检测是否与二维矩形发生相交. More...
 
bool intersectsX (float x) const
 
bool intersectsY (float y) const
 
bool isValid () const
 

Public Attributes

Vector2 origin
 
Size2 size
 

Detailed Description

二维矩形, 单精度.

Constructor & Destructor Documentation

◆ Rect2() [1/2]

Rect2::Rect2 ( const Point2 origin,
const Size2 size 
)

构造函数.

Parameters
origin矩形坐标, 左上角.
size矩形大小.

◆ Rect2() [2/2]

Rect2::Rect2 ( float  x,
float  y,
float  width,
float  height 
)

构造函数.

Parameters
xx坐标.
yy坐标.
width宽度.
height高度.

Member Function Documentation

◆ intersectsPoint()

bool Rect2::intersectsPoint ( const Point2 point) const

检测是否与二维点发生相交.

Parameters
point要检测的二维点的坐标.
Returns
相交则返回 true, 否则返回 false.

◆ intersectsRect()

bool Rect2::intersectsRect ( const Rect2 rect) const

检测是否与二维矩形发生相交.

Parameters
point要检测的二维矩形的坐标.
Returns
相交则返回 true, 否则返回 false.

The documentation for this class was generated from the following files: