Fix 30+ broken cross-references in docs/api/math/: - viewport: viewport-getaspectratio/getrect -> getaspectratio/getrect - matrix4: ../color/operator-mul -> operator_mul, operator-index -> operator_index - matrix4/get-*: gettranslation/getscale/getrotation -> get-translation/-scale/-rotation - vector3 operator links: operator_*_assign -> operator-*-assign - vector3 operator links: operator_sub/add -> operator-sub/add - vector3 operator-eq/neq: swap mutual references to use hyphen naming - vector4: ../plane/constructor-default -> constructor_default - Linter fixes: aabb and rectint relative paths corrected
54 lines
1.5 KiB
Markdown
54 lines
1.5 KiB
Markdown
# RectInt
|
|
|
|
整数矩形结构体,用于像素级 2D 区域表示。
|
|
|
|
**头文件:** `#include <XCEngine/Math/Rect.h>`
|
|
|
|
**命名空间:** `XCEngine::Math`
|
|
|
|
## 结构体定义
|
|
|
|
```cpp
|
|
struct RectInt {
|
|
int32_t x = 0;
|
|
int32_t y = 0;
|
|
int32_t width = 0;
|
|
int32_t height = 0;
|
|
|
|
RectInt() = default;
|
|
RectInt(int32_t x, int32_t y, int32_t w, int32_t h);
|
|
};
|
|
```
|
|
|
|
## 构造函数
|
|
|
|
| 方法 | 描述 |
|
|
|------|------|
|
|
| `RectInt()` | 默认构造 |
|
|
| `RectInt(x, y, w, h)` | 从整数坐标和尺寸构造 |
|
|
|
|
## 边界访问
|
|
|
|
| 方法 | 返回值 | 描述 |
|
|
|------|--------|------|
|
|
| [GetLeft()](rectint-getleft.md) | `int32_t` | 左边界 |
|
|
| [GetRight()](rectint-getright.md) | `int32_t` | 右边界 |
|
|
| [GetTop()](rectint-gettop.md) | `int32_t` | 上边界 |
|
|
| [GetBottom()](rectint-getbottom.md) | `int32_t` | 下边界 |
|
|
| [GetPosition()](rectint-getposition.md) | `Vector2` | 位置(转换为浮点) |
|
|
| [GetSize()](rectint-getsize.md) | `Vector2` | 尺寸(转换为浮点) |
|
|
| [GetCenter()](rectint-getcenter.md) | `Vector2` | 中心点 |
|
|
|
|
## 检测方法
|
|
|
|
| 方法 | 返回值 | 描述 |
|
|
|------|--------|------|
|
|
| [Contains(px, py)](rectint-contains.md) | `bool` | 整数坐标点检测 |
|
|
| [Intersects(other)](rectint-intersects.md) | `bool` | 与另一矩形相交 |
|
|
|
|
## 相关文档
|
|
|
|
- [Math 模块总览](../math.md) - 返回 Rect 模块总览
|
|
- [Rect](../rect/rect-overview.md) - 浮点矩形版本
|
|
- [Viewport](../viewport/viewport.md) - 渲染视口
|