docs: update math API docs

This commit is contained in:
2026-03-20 02:35:15 +08:00
parent e165dbea1c
commit c5b17239ca
243 changed files with 5307 additions and 1327 deletions

View File

@@ -0,0 +1,48 @@
# RectInt::Intersects
```cpp
bool Intersects(const RectInt& other) const;
```
判断此矩形是否与另一矩形相交。
使用 AABB轴对齐包围盒碰撞检测算法。如果两个矩形在 x 轴和 y 轴上都有重叠,则返回 true。
**参数:**
- `other` - 另一个矩形
**返回:** 两矩形相交返回 true否则返回 false
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
#include "XCEngine/Math/Rect.h"
#include <iostream>
using namespace XCEngine::Math;
int main() {
RectInt rectA(0, 0, 100, 100);
RectInt rectB(50, 50, 100, 100);
if (rectA.Intersects(rectB)) {
std::cout << "Rects intersect\n";
}
RectInt rectC(200, 200, 50, 50);
if (!rectA.Intersects(rectC)) {
std::cout << "Rects do not intersect\n";
}
return 0;
}
```
## 相关文档
- [`RectInt::Contains`](contains.md) - 判断点是否在矩形内
- [RectInt 总览](rectint.md)