- Fix link resolution with proper relative/absolute path handling - Improve link styling with underline decoration - Hide leaf nodes from tree, only show directories - Fix log file path for packaged app
26 lines
554 B
Markdown
26 lines
554 B
Markdown
# Vector2::SqrMagnitude
|
|
|
|
```cpp
|
|
static float SqrMagnitude(const Vector2& v)
|
|
float SqrMagnitude() const
|
|
```
|
|
|
|
计算向量长度的平方。比 Magnitude 更快,避免了开方运算。
|
|
|
|
**静态版本参数:**
|
|
- `v` - 要计算长度的向量
|
|
|
|
**实例版本:** 计算当前向量的长度平方。
|
|
|
|
**返回:** `float` - 向量长度平方 x * x + y * y
|
|
|
|
**复杂度:** O(1)
|
|
|
|
**示例:**
|
|
|
|
```cpp
|
|
Vector2 v(3.0f, 4.0f);
|
|
float sqlen = v.SqrMagnitude(); // 25.0f
|
|
float sqlen2 = Vector2::SqrMagnitude(v); // 25.0f
|
|
```
|