Update API documentation and remove obsolete plan files
This commit is contained in:
@@ -1,48 +1,24 @@
|
||||
# RectInt::Intersects
|
||||
|
||||
```cpp
|
||||
bool Intersects(const RectInt& other) const;
|
||||
bool Intersects(const RectInt& other) const
|
||||
```
|
||||
|
||||
判断此矩形是否与另一矩形相交。
|
||||
|
||||
使用 AABB(轴对齐包围盒)碰撞检测算法。如果两个矩形在 x 轴和 y 轴上都有重叠,则返回 true。
|
||||
检测两整数矩形是否相交。
|
||||
|
||||
**参数:**
|
||||
- `other` - 另一个矩形
|
||||
- `other` - 另一个整数矩形
|
||||
|
||||
**返回:** 两矩形相交返回 true,否则返回 false
|
||||
|
||||
**线程安全:** ✅
|
||||
**返回:** `bool` - 两矩形相交返回 true
|
||||
|
||||
**复杂度:** 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 rectA(0, 0, 100, 100);
|
||||
RectInt rectB(50, 50, 100, 100);
|
||||
if (rectA.Intersects(rectB)) {
|
||||
// 两矩形相交
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [`RectInt::Contains`](contains.md) - 判断点是否在矩形内
|
||||
- [RectInt 总览](rectint.md)
|
||||
Reference in New Issue
Block a user