Update API documentation and remove obsolete plan files

This commit is contained in:
2026-03-21 15:55:04 +08:00
parent 7a6cd412c8
commit 629455df07
75 changed files with 1075 additions and 1816 deletions

View File

@@ -0,0 +1,29 @@
# Vector2::operator+=
```cpp
Vector2& operator+=(const Vector2& other)
```
向量加法赋值,将 `other` 的分量加到当前向量。
**参数:**
- `other` - 要加的向量
**返回:** `Vector2&` - 引用到修改后的当前向量
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
Vector2 v(1.0f, 2.0f);
v += Vector2(3.0f, 4.0f); // v = (4.0f, 6.0f)
```
## 相关文档
- [Vector2 总览](vector2.md)
- [`operator+`](operator-add.md) - 加法
- [`operator-=`](operator-sub-assign.md) - 减法赋值

View File

@@ -0,0 +1,30 @@
# Vector2::operator+
```cpp
Vector2 operator+(const Vector2& other) const
```
向量加法,将当前向量与另一个向量相加。
**参数:**
- `other` - 要相加的向量
**返回:** `Vector2` - 相加结果向量
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
Vector2 a(1.0f, 2.0f);
Vector2 b(3.0f, 4.0f);
Vector2 c = a + b; // (4.0f, 6.0f)
```
## 相关文档
- [Vector2 总览](vector2.md)
- [`operator-`](operator-sub.md) - 减法
- [`operator+=`](operator-add-assign.md) - 加法赋值

View File

@@ -0,0 +1,29 @@
# Vector2::operator/=
```cpp
Vector2& operator/=(float scalar)
```
向量除法赋值,将当前向量除以标量。
**参数:**
- `scalar` - 标量值(不能为零)
**返回:** `Vector2&` - 引用到修改后的当前向量
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
Vector2 v(4.0f, 6.0f);
v /= 2.0f; // v = (2.0f, 3.0f)
```
## 相关文档
- [Vector2 总览](vector2.md)
- [`operator/`](operator-div.md) - 除法
- [`operator*=`](operator-mul-assign.md) - 乘法赋值

View File

@@ -0,0 +1,29 @@
# Vector2::operator/
```cpp
Vector2 operator/(float scalar) const
```
向量数除,将向量除以标量。
**参数:**
- `scalar` - 标量值(不能为零)
**返回:** `Vector2` - 缩放后的向量
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
Vector2 v(4.0f, 6.0f);
Vector2 result = v / 2.0f; // (2.0f, 3.0f)
```
## 相关文档
- [Vector2 总览](vector2.md)
- [`operator*`](operator-mul.md) - 乘法
- [`operator/=`](operator-div-assign.md) - 除法赋值

View File

@@ -0,0 +1,29 @@
# Vector2::operator==
```cpp
bool operator==(const Vector2& other) const
```
判断两个向量是否相等。使用 EPSILON 进行浮点比较。
**参数:**
- `other` - 要比较的向量
**返回:** `bool` - 如果所有分量差的绝对值都小于 EPSILON 则返回 true
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
Vector2 a(1.0f, 2.0f);
Vector2 b(1.0f, 2.0f);
bool equal = (a == b); // true
```
## 相关文档
- [Vector2 总览](vector2.md)
- [`operator!=`](operator-neq.md) - 不等比较

View File

@@ -0,0 +1,29 @@
# Vector2::operator*=
```cpp
Vector2& operator*=(float scalar)
```
向量乘法赋值,将当前向量乘以标量。
**参数:**
- `scalar` - 标量值
**返回:** `Vector2&` - 引用到修改后的当前向量
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
Vector2 v(2.0f, 3.0f);
v *= 2.0f; // v = (4.0f, 6.0f)
```
## 相关文档
- [Vector2 总览](vector2.md)
- [`operator*`](operator-mul.md) - 乘法
- [`operator/=`](operator-div-assign.md) - 除法赋值

View File

@@ -0,0 +1,29 @@
# Vector2::operator*
```cpp
Vector2 operator*(float scalar) const
```
向量数乘,将向量与标量相乘。
**参数:**
- `scalar` - 标量值
**返回:** `Vector2` - 缩放后的向量
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
Vector2 v(2.0f, 3.0f);
Vector2 scaled = v * 2.0f; // (4.0f, 6.0f)
```
## 相关文档
- [Vector2 总览](vector2.md)
- [`operator/`](operator-div.md) - 除法
- [`operator*=`](operator-mul-assign.md) - 乘法赋值

View File

@@ -0,0 +1,29 @@
# Vector2::operator!=
```cpp
bool operator!=(const Vector2& other) const
```
判断两个向量是否不相等。
**参数:**
- `other` - 要比较的向量
**返回:** `bool` - 如果任何分量差的绝对值大于等于 EPSILON 则返回 true
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
Vector2 a(1.0f, 2.0f);
Vector2 b(3.0f, 4.0f);
bool notEqual = (a != b); // true
```
## 相关文档
- [Vector2 总览](vector2.md)
- [`operator==`](operator-eq.md) - 相等比较

View File

@@ -0,0 +1,29 @@
# Vector2::operator-=
```cpp
Vector2& operator-=(const Vector2& other)
```
向量减法赋值,将 `other` 的分量从当前向量减去。
**参数:**
- `other` - 要减的向量
**返回:** `Vector2&` - 引用到修改后的当前向量
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
Vector2 v(5.0f, 8.0f);
v -= Vector2(2.0f, 3.0f); // v = (3.0f, 5.0f)
```
## 相关文档
- [Vector2 总览](vector2.md)
- [`operator-`](operator-sub.md) - 减法
- [`operator+=`](operator-add-assign.md) - 加法赋值

View File

@@ -0,0 +1,30 @@
# Vector2::operator-
```cpp
Vector2 operator-(const Vector2& other) const
```
向量减法,将当前向量减去另一个向量。
**参数:**
- `other` - 要减去的向量
**返回:** `Vector2` - 相减结果向量
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
Vector2 a(5.0f, 8.0f);
Vector2 b(2.0f, 3.0f);
Vector2 c = a - b; // (3.0f, 5.0f)
```
## 相关文档
- [Vector2 总览](vector2.md)
- [`operator+`](operator-add.md) - 加法
- [`operator-=`](operator-sub-assign.md) - 减法赋值

View File

@@ -23,31 +23,30 @@ Vector2 是 XCEngine 中的二维向量结构体,用于表示 2D 空间中的
| 方法 | 描述 |
|------|------|
| [`Zero`](Zero.md) | 返回 (0, 0) 零向量 |
| [`One`](One.md) | 返回 (1, 1) 单位向量 |
| [`Up`](Up.md) | 返回 (0, 1) 上方向 |
| [`Down`](Down.md) | 返回 (0, -1) 下方向 |
| [`Right`](Right.md) | 返回 (1, 0) 右方向 |
| [`Left`](Left.md) | 返回 (-1, 0) 左方向 |
| [`Dot`](Dot.md) | 计算两个向量的点积 |
| [`Cross`](Cross.md) | 计算两个向量的叉积(返回标量) |
| [`Normalize`](Normalize.md) | 归一化向量为单位长度 |
| [`Magnitude`](Magnitude.md) | 计算向量长度 |
| [`SqrMagnitude`](SqrMagnitude.md) | 计算向量长度平方 |
| [`Lerp`](Lerp.md) | 线性插值 |
| [`MoveTowards`](MoveTowards.md) | 朝目标移动 |
| [`Magnitude`](Magnitude.md) | 实例方法,计算当前向量长度 |
| [`SqrMagnitude`](SqrMagnitude.md) | 实例方法,计算当前向量长度平方 |
| [`Normalized`](Normalized.md) | 实例方法,返回归一化副本 |
| [`Zero`](zero.md) | 返回 (0, 0) 零向量 |
| [`One`](one.md) | 返回 (1, 1) 单位向量 |
| [`Up`](up.md) | 返回 (0, 1) 上方向 |
| [`Down`](down.md) | 返回 (0, -1) 下方向 |
| [`Right`](right.md) | 返回 (1, 0) 右方向 |
| [`Left`](left.md) | 返回 (-1, 0) 左方向 |
| [`Dot`](dot.md) | 计算两个向量的点积 |
| [`Cross`](cross.md) | 计算两个向量的叉积(返回标量) |
| [`Normalize`](normalize.md) | 归一化向量为单位长度(静态方法) |
| [`Magnitude`](magnitude.md) | 计算向量长度 |
| [`SqrMagnitude`](sqrmagnitude.md) | 计算向量长度平方 |
| [`Lerp`](lerp.md) | 线性插值 |
| [`MoveTowards`](movetowards.md) | 朝目标移动 |
| [`Normalized`](normalized.md) | 实例方法,返回归一化副本 |
## 运算符
| 运算符 | 描述 |
|--------|------|
| `+`, `-` | 向量加减运算 |
| `*`, `/` | 向量与标量乘除运算 |
| `+=`, `-=`, `*=`, `/=` | 复合赋值运算 |
| `==`, `!=` | 相等性比较(基于 EPSILON 浮点比较) |
| [`+`](operator-add.md), [`-`](operator-sub.md) | 向量加减运算 |
| [`*`](operator-mul.md), [`/`](operator-div.md) | 向量与标量乘除运算 |
| [`*=`](operator-mul-assign.md), [`/=`](operator-div-assign.md) | 复合赋值运算 |
| [`+=`](operator-add-assign.md), [`-=`](operator-sub-assign.md) | 复合赋值运算 |
| [`==`](operator-eq.md), [`!=`](operator-neq.md) | 相等性比较(基于 EPSILON 浮点比较) |
## 使用示例