Files
XCEngine/docs/api/math/plane/plane.md

41 lines
1.0 KiB
Markdown
Raw Normal View History

# Plane
3D 平面结构体,由法线和距离表示。
**头文件:** `#include <XCEngine/Math/Plane.h>`
**命名空间:** `XCEngine::Math`
## 结构体定义
```cpp
struct Plane {
Vector3 normal = Vector3::Up();
float distance = 0.0f;
};
```
## 构造函数
- `Plane()` - 默认构造 (y=0 平面)
- `Plane(const Vector3& normal, float distance)` - 从法线和距离构造
## 静态工厂方法
| 方法 | 返回值 | 描述 |
|------|--------|------|
| [FromPoints(a, b, c)](frompoints.md) | `Plane` | 从三个不共线点创建 |
## 实例方法
| 方法 | 返回值 | 描述 |
|------|--------|------|
| [GetDistanceToPoint(point)](getdistancetopoint.md) | `float` | 点到平面的有符号距离 |
| [GetClosestPoint(point)](getclosestpoint.md) | `Vector3` | 平面上最接近给定点的点 |
| [GetSide(point)](getside.md) | `bool` | 点在平面的哪一侧 |
| [Intersects(sphere)](intersects.md) | `bool` | 与球体相交 |
## 相关文档
- [Math 模块总览](../math.md) - 返回 Math 模块总览