docs: update math API docs
This commit is contained in:
@@ -4,17 +4,37 @@
|
||||
bool Contains(const Vector3& point) const
|
||||
```
|
||||
|
||||
检测点是否在球体内(包括表面)。
|
||||
检测点是否在球体内(包括球体表面)。使用平方距离比较避免开平方运算。
|
||||
|
||||
**参数:**
|
||||
- `point` - 要检测的点
|
||||
|
||||
**返回:** `bool` - true 表示点在球体内
|
||||
**返回:** `bool` - true 表示点在球体内(包括表面)
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
if (sphere.Contains(point)) { /* point inside */ }
|
||||
#include <XCEngine/Math/Sphere.h>
|
||||
#include <XCEngine/Math/Vector3.h>
|
||||
|
||||
using namespace XCEngine::Math;
|
||||
|
||||
Sphere sphere(Vector3(0.0f, 0.0f, 0.0f), 1.0f);
|
||||
|
||||
Vector3 inside(0.5f, 0.0f, 0.0f);
|
||||
if (sphere.Contains(inside)) {
|
||||
}
|
||||
|
||||
Vector3 outside(2.0f, 0.0f, 0.0f);
|
||||
if (!sphere.Contains(outside)) {
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Sphere](sphere.md) - 返回类总览
|
||||
- [Intersects](intersects.md) - 球体相交检测
|
||||
|
||||
Reference in New Issue
Block a user