Update API documentation and remove obsolete plan files
This commit is contained in:
@@ -1,47 +1,24 @@
|
||||
# RectInt::Contains
|
||||
|
||||
```cpp
|
||||
bool Contains(int32_t px, int32_t py) const;
|
||||
bool Contains(int32_t px, int32_t py) const
|
||||
```
|
||||
|
||||
判断整数坐标点是否在矩形内部。
|
||||
|
||||
矩形使用左上位坐标系,内部定义为:x >= left && x < right && y >= top && y < bottom。即左边界和上边界在内部,右边界和下边界在外部。
|
||||
检测整数坐标点是否在矩形内。
|
||||
|
||||
**参数:**
|
||||
- `px` - 点的 x 坐标
|
||||
- `py` - 点的 y 坐标
|
||||
|
||||
**返回:** 点在矩形内部返回 true,否则返回 false
|
||||
|
||||
**线程安全:** ✅
|
||||
**返回:** `bool` - 点在矩形内(包含边界)返回 true
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
#include "XCEngine/Math/Rect.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace XCEngine::Math;
|
||||
|
||||
int main() {
|
||||
RectInt rect(0, 0, 1920, 1080);
|
||||
|
||||
if (rect.Contains(960, 540)) {
|
||||
std::cout << "Point (960, 540) is inside\n";
|
||||
}
|
||||
|
||||
if (!rect.Contains(2000, 1000)) {
|
||||
std::cout << "Point (2000, 1000) is outside\n";
|
||||
}
|
||||
|
||||
return 0;
|
||||
RectInt rect(0, 0, 1920, 1080);
|
||||
if (rect.Contains(pixelX, pixelY)) {
|
||||
// 像素在矩形内
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [`RectInt::Intersects`](intersects.md) - 判断是否相交
|
||||
- [RectInt 总览](rectint.md)
|
||||
Reference in New Issue
Block a user