21 lines
316 B
Markdown
21 lines
316 B
Markdown
|
|
# Box::Intersects (Box)
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
bool Intersects(const Box& other) const
|
||
|
|
```
|
||
|
|
|
||
|
|
检测两个 OBB 是否相交(使用 SAT 算法)。
|
||
|
|
|
||
|
|
**参数:**
|
||
|
|
- `other` - 另一个 OBB
|
||
|
|
|
||
|
|
**返回:** `bool` - true 表示相交
|
||
|
|
|
||
|
|
**复杂度:** O(1)
|
||
|
|
|
||
|
|
**示例:**
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
if (box.Intersects(otherBox)) { /* collision */ }
|
||
|
|
```
|