Update API documentation and remove obsolete plan files
This commit is contained in:
@@ -65,5 +65,5 @@ struct Rect {
|
||||
## 相关文档
|
||||
|
||||
- [Math 模块总览](../math.md) - 返回 Rect 模块总览
|
||||
- [RectInt](rectint.md) - 整数矩形版本
|
||||
- [Viewport](viewport.md) - 渲染视口
|
||||
- [RectInt](../rectint/rectint.md) - 整数矩形版本
|
||||
- [Viewport](../viewport/viewport.md) - 渲染视口
|
||||
|
||||
@@ -76,6 +76,6 @@ int main() {
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [`RectInt`](rectint.md) - 整数矩形
|
||||
- [`Viewport`](viewport.md) - 视口
|
||||
- [`RectInt`](../rectint/rectint.md) - 整数矩形
|
||||
- [`Viewport`](../viewport/viewport.md) - 视口
|
||||
- [`Vector2`](../vector2/vector2.md) - 二维向量
|
||||
@@ -1,24 +0,0 @@
|
||||
# RectInt::Contains
|
||||
|
||||
```cpp
|
||||
bool Contains(int32_t px, int32_t py) const
|
||||
```
|
||||
|
||||
检测整数坐标点是否在矩形内。
|
||||
|
||||
**参数:**
|
||||
- `px` - 点的 x 坐标
|
||||
- `py` - 点的 y 坐标
|
||||
|
||||
**返回:** `bool` - 点在矩形内(包含边界)返回 true
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
RectInt rect(0, 0, 1920, 1080);
|
||||
if (rect.Contains(pixelX, pixelY)) {
|
||||
// 像素在矩形内
|
||||
}
|
||||
```
|
||||
@@ -1,18 +0,0 @@
|
||||
# RectInt::GetBottom
|
||||
|
||||
```cpp
|
||||
int32_t GetBottom() const
|
||||
```
|
||||
|
||||
获取矩形下边界。
|
||||
|
||||
**返回:** `int32_t` - 下边界坐标 (y + height)
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
RectInt rect(10, 20, 100, 50);
|
||||
int32_t bottom = rect.GetBottom(); // 70
|
||||
```
|
||||
@@ -1,18 +0,0 @@
|
||||
# RectInt::GetCenter
|
||||
|
||||
```cpp
|
||||
Vector2 GetCenter() const
|
||||
```
|
||||
|
||||
获取矩形中心点(转换为浮点)。
|
||||
|
||||
**返回:** `Vector2` - 中心点坐标
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
RectInt rect(10, 20, 100, 50);
|
||||
Vector2 center = rect.GetCenter(); // (60.0f, 45.0f)
|
||||
```
|
||||
@@ -1,18 +0,0 @@
|
||||
# RectInt::GetLeft
|
||||
|
||||
```cpp
|
||||
int32_t GetLeft() const
|
||||
```
|
||||
|
||||
获取矩形左边界。
|
||||
|
||||
**返回:** `int32_t` - 左边界坐标 (x)
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
RectInt rect(10, 20, 100, 50);
|
||||
int32_t left = rect.GetLeft(); // 10
|
||||
```
|
||||
@@ -1,18 +0,0 @@
|
||||
# RectInt::GetPosition
|
||||
|
||||
```cpp
|
||||
Vector2 GetPosition() const
|
||||
```
|
||||
|
||||
获取矩形左上角位置(转换为浮点)。
|
||||
|
||||
**返回:** `Vector2` - 位置向量
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
RectInt rect(10, 20, 100, 50);
|
||||
Vector2 pos = rect.GetPosition(); // (10.0f, 20.0f)
|
||||
```
|
||||
@@ -1,18 +0,0 @@
|
||||
# RectInt::GetRight
|
||||
|
||||
```cpp
|
||||
int32_t GetRight() const
|
||||
```
|
||||
|
||||
获取矩形右边界。
|
||||
|
||||
**返回:** `int32_t` - 右边界坐标 (x + width)
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
RectInt rect(10, 20, 100, 50);
|
||||
int32_t right = rect.GetRight(); // 110
|
||||
```
|
||||
@@ -1,18 +0,0 @@
|
||||
# RectInt::GetSize
|
||||
|
||||
```cpp
|
||||
Vector2 GetSize() const
|
||||
```
|
||||
|
||||
获取矩形尺寸(转换为浮点)。
|
||||
|
||||
**返回:** `Vector2` - 尺寸向量
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
RectInt rect(10, 20, 100, 50);
|
||||
Vector2 size = rect.GetSize(); // (100.0f, 50.0f)
|
||||
```
|
||||
@@ -1,18 +0,0 @@
|
||||
# RectInt::GetTop
|
||||
|
||||
```cpp
|
||||
int32_t GetTop() const
|
||||
```
|
||||
|
||||
获取矩形上边界。
|
||||
|
||||
**返回:** `int32_t` - 上边界坐标 (y)
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
RectInt rect(10, 20, 100, 50);
|
||||
int32_t top = rect.GetTop(); // 20
|
||||
```
|
||||
@@ -1,24 +0,0 @@
|
||||
# RectInt::Intersects
|
||||
|
||||
```cpp
|
||||
bool Intersects(const RectInt& other) const
|
||||
```
|
||||
|
||||
检测两整数矩形是否相交。
|
||||
|
||||
**参数:**
|
||||
- `other` - 另一个整数矩形
|
||||
|
||||
**返回:** `bool` - 两矩形相交返回 true
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
RectInt rectA(0, 0, 100, 100);
|
||||
RectInt rectB(50, 50, 100, 100);
|
||||
if (rectA.Intersects(rectB)) {
|
||||
// 两矩形相交
|
||||
}
|
||||
```
|
||||
@@ -1,53 +0,0 @@
|
||||
# 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-overview.md) - 浮点矩形版本
|
||||
- [Viewport](viewport.md) - 渲染视口
|
||||
@@ -1,18 +0,0 @@
|
||||
# Viewport::GetAspectRatio
|
||||
|
||||
```cpp
|
||||
float GetAspectRatio() const
|
||||
```
|
||||
|
||||
获取视口宽高比。
|
||||
|
||||
**返回:** `float` - 宽高比 (width / height),height 为 0 时返回 0.0f
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Viewport viewport(0, 0, 1920, 1080);
|
||||
float aspect = viewport.GetAspectRatio(); // 1.777... (16:9)
|
||||
```
|
||||
@@ -1,18 +0,0 @@
|
||||
# Viewport::GetRect
|
||||
|
||||
```cpp
|
||||
Rect GetRect() const
|
||||
```
|
||||
|
||||
将视口转换为 Rect。
|
||||
|
||||
**返回:** `Rect` - 对应的矩形 (x, y, width, height),不包含深度范围
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Viewport viewport(0, 0, 1920, 1080, 0.0f, 1.0f);
|
||||
Rect rect = viewport.GetRect(); // (0, 0, 1920, 1080)
|
||||
```
|
||||
@@ -1,45 +0,0 @@
|
||||
# Viewport
|
||||
|
||||
渲染视口结构体,用于屏幕到归一化坐标的映射。
|
||||
|
||||
**头文件:** `#include <XCEngine/Math/Rect.h>`
|
||||
|
||||
**命名空间:** `XCEngine::Math`
|
||||
|
||||
## 结构体定义
|
||||
|
||||
```cpp
|
||||
struct Viewport {
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
float width = 0.0f;
|
||||
float height = 0.0f;
|
||||
float minDepth = 0.0f;
|
||||
float maxDepth = 1.0f;
|
||||
|
||||
Viewport() = default;
|
||||
Viewport(float x, float y, float w, float h);
|
||||
Viewport(float x, float y, float w, float h, float minD, float maxD);
|
||||
};
|
||||
```
|
||||
|
||||
## 构造函数
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| `Viewport()` | 默认构造 |
|
||||
| `Viewport(x, y, w, h)` | 2D 视口 |
|
||||
| `Viewport(x, y, w, h, minD, maxD)` | 带深度范围的 3D 视口 |
|
||||
|
||||
## 方法
|
||||
|
||||
| 方法 | 返回值 | 描述 |
|
||||
|------|--------|------|
|
||||
| [GetAspectRatio()](viewport-getaspectratio.md) | `float` | 宽高比 (width / height) |
|
||||
| [GetRect()](viewport-getrect.md) | `Rect` | 转换为 Rect |
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Math 模块总览](../math.md) - 返回 Math 模块总览
|
||||
- [Rect](rect-overview.md) - 浮点矩形
|
||||
- [RectInt](rectint.md) - 整数矩形
|
||||
Reference in New Issue
Block a user