docs: update math API docs
This commit is contained in:
35
docs/api/math/rectint/getcenter.md
Normal file
35
docs/api/math/rectint/getcenter.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# RectInt::GetCenter
|
||||
|
||||
```cpp
|
||||
Vector2 GetCenter() const;
|
||||
```
|
||||
|
||||
获取矩形中心点坐标。
|
||||
|
||||
**返回:** 表示矩形中心点的 Vector2(转换为浮点)
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
#include "XCEngine/Math/Rect.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace XCEngine::Math;
|
||||
|
||||
int main() {
|
||||
RectInt rect(10, 20, 100, 50);
|
||||
Vector2 center = rect.GetCenter();
|
||||
std::cout << "Center: (" << center.x << ", " << center.y << ")\n";
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [`RectInt::GetPosition`](getposition.md) - 获取位置
|
||||
- [`RectInt::GetSize`](getsize.md) - 获取尺寸
|
||||
- [RectInt 总览](rectint.md)
|
||||
Reference in New Issue
Block a user