docs: update math API docs
This commit is contained in:
@@ -4,19 +4,29 @@
|
||||
Vector3 GetPoint(float t) const
|
||||
```
|
||||
|
||||
获取射线上指定距离处的点。
|
||||
获取射线上指定参数距离处的点。计算公式:`origin + direction * t`
|
||||
|
||||
**参数:**
|
||||
- `t` - 沿射线方向的参数距离
|
||||
|
||||
**返回:** `Vector3` - 射线上的点 `origin + direction * t`
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Ray ray(cameraPosition, mouseRayDir.Normalized());
|
||||
float t = 100.0f;
|
||||
Vector3 point = ray.GetPoint(t); // 沿射线方向 100 单位处的点
|
||||
#include <XCEngine/Math/Ray.h>
|
||||
#include <XCEngine/Math/Vector3.h>
|
||||
|
||||
using namespace XCEngine::Math;
|
||||
|
||||
Ray ray(Vector3(0.0f, 0.0f, 0.0f), Vector3(1.0f, 0.0f, 0.0f));
|
||||
Vector3 point = ray.GetPoint(100.0f); // point = (100, 0, 0)
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Ray 类总览](ray.md) - 返回类总览
|
||||
|
||||
Reference in New Issue
Block a user