33 lines
630 B
Markdown
33 lines
630 B
Markdown
# Ray::GetPoint
|
|
|
|
```cpp
|
|
Vector3 GetPoint(float t) const
|
|
```
|
|
|
|
获取射线上指定参数距离处的点。计算公式:`origin + direction * t`
|
|
|
|
**参数:**
|
|
- `t` - 沿射线方向的参数距离
|
|
|
|
**返回:** `Vector3` - 射线上的点 `origin + direction * t`
|
|
|
|
**线程安全:** ✅
|
|
|
|
**复杂度:** O(1)
|
|
|
|
**示例:**
|
|
|
|
```cpp
|
|
#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) - 返回类总览
|