Files
XCEngine/docs/api/math/vector4/vector4.md
ssdfasd f436280aa5 Fix math documentation discrepancies
- Vector4.md: Add index mapping (0=x, 1=y, 2=z, 3=w) to operator[] description
- Transform.md: Add proper '运算符' subsection header for operator* documentation

Found and fixed missing operator documentation:
- Vector4: operator[] index mapping was undocumented
- Transform: operator* was listed without proper section header
2026-03-19 01:05:17 +08:00

54 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Vector4
4D 向量结构体,用于表示齐次坐标、颜色 (RGBA) 或 SIMD 操作。
**头文件:** `#include <XCEngine/Math/Vector4.h>`
**命名空间:** `XCEngine::Math`
## 结构体定义
```cpp
struct Vector4 {
float x = 0.0f;
float y = 0.0f;
float z = 0.0f;
float w = 0.0f;
};
```
## 构造函数
- `Vector4(float x, float y, float z, float w)` - 从四个分量构造
- `explicit Vector4(const Vector3& v, float w = 0.0f)` - 从 Vector3 构造
## 静态工厂方法
| 方法 | 返回值 | 描述 |
|------|--------|------|
| [Zero()](zero.md) | `Vector4` | 返回 (0, 0, 0, 0) |
| [One()](one.md) | `Vector4` | 返回 (1, 1, 1, 1) |
## 静态数学方法
| 方法 | 返回值 | 描述 |
|------|--------|------|
| [Dot(a, b)](dot.md) | `float` | 4D 点积 |
| [Project(vector, onNormal)](project.md) | `Vector4` | 投影 |
## 实例方法
| 方法 | 返回值 | 描述 |
|------|--------|------|
| [ToVector3()](tovector3.md) | `Vector3` | 转换到 Vector3丢弃 w |
## 运算符
- 算术: `+`, `-`, `*` (scalar)
- 下标: `operator[]` (0=x, 1=y, 2=z, 3=w)
- 比较: `==`, `!=`
## 相关文档
- [Math 模块总览](../math.md) - 返回 Math 模块总览