docs: update math API docs
This commit is contained in:
34
docs/api/math/obb/intersects-obb.md
Normal file
34
docs/api/math/obb/intersects-obb.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# OBB::Intersects (OBB)
|
||||
|
||||
```cpp
|
||||
bool Intersects(const OBB& other) const;
|
||||
```
|
||||
|
||||
检测该 OBB 与另一个 OBB 是否相交。采用分离轴定理(SAT)进行检测,通过测试 15 条可能的分离轴来判断两个盒子是否重叠。
|
||||
|
||||
**参数:**
|
||||
- `other` - 另一个 OBB 包围盒
|
||||
|
||||
**返回:** 两 OBB 相交返回 `true`,否则返回 `false`
|
||||
|
||||
**异常:** 无
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
#include "AABB.h"
|
||||
#include "Vector3.h"
|
||||
#include "Matrix4.h"
|
||||
|
||||
using namespace XCEngine::Math;
|
||||
|
||||
OBB obb1(Vector3(0.0f, 0.0f, 0.0f), Vector3(1.0f, 0.5f, 1.0f));
|
||||
OBB obb2(Vector3(1.5f, 0.0f, 0.0f), Vector3(1.0f, 0.5f, 1.0f));
|
||||
|
||||
if (obb1.Intersects(obb2)) {
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user