Files
XCSDD/docs/api/math/vector4/vector4.md
ssdfasd 58a83f445a fix: improve doc link navigation and tree display
- 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
2026-03-19 12:44:08 +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 模块总览