docs: update math API docs

This commit is contained in:
2026-03-20 02:35:15 +08:00
parent e165dbea1c
commit c5b17239ca
243 changed files with 5307 additions and 1327 deletions

View File

@@ -5,7 +5,7 @@ static float SqrMagnitude(const Vector2& v)
float SqrMagnitude() const
```
计算向量长度的平方。比 Magnitude 更快,避免了开方运算。
计算向量长度的平方。比 Magnitude 更快,避免了开方运算。在比较相对长度或进行性能敏感的计算时优先使用。
**静态版本参数:**
- `v` - 要计算长度的向量
@@ -14,6 +14,10 @@ float SqrMagnitude() const
**返回:** `float` - 向量长度平方 x * x + y * y
**线程安全:**
**异常:** (无)
**复杂度:** O(1)
**示例:**
@@ -23,3 +27,8 @@ Vector2 v(3.0f, 4.0f);
float sqlen = v.SqrMagnitude(); // 25.0f
float sqlen2 = Vector2::SqrMagnitude(v); // 25.0f
```
## 相关文档
- [Vector2](vector2.md) - 返回类总览
- [Magnitude](magnitude.md) - 向量长度