Fixed broken references: - texture-import-settings: Fix 16 files referencing wrong overview filename - math/rectint: Fix 9 method links (rectint-* → get*, contains, intersects) - rhi/opengl/device: Fix 8 cross-references (opengl-* → */**) - resources/mesh: Fix meshsection and vertexattribute links - rhi/d3d12/sampler: Fix RHISampler reference path - math/vector3: Fix projectonplane → project-on-plane - rhi/opengl/command-list: Remove broken ClearFlag enum ref - rhi/opengl/device: Create 2 new method docs (MakeContextCurrent, GetNativeContext) - rhi/device: Fix device-info types reference All 0 broken references remaining.
950 B
950 B
Plane::Intersects
bool Intersects(const Sphere& sphere) const
检测平面是否与球体相交。球体与平面相交的条件是:球心到平面的有符号距离的绝对值小于等于球体半径。
参数:
sphere- 要检测的球体
返回: bool - true 表示相交,false 表示不相交
线程安全: ✅
复杂度: O(1)
示例:
#include <XCEngine/Core/Math/Plane.h>
#include <XCEngine/Core/Math/Sphere.h>
#include <XCEngine/Core/Math/Vector3.h>
using namespace XCEngine::Math;
void IntersectsExample() {
Plane plane(Vector3::Up(), 0.0f);
Sphere sphere1(Vector3(0.0f, 0.5f, 0.0f), 1.0f);
bool intersects1 = plane.Intersects(sphere1);
Sphere sphere2(Vector3(0.0f, 5.0f, 0.0f), 1.0f);
bool intersects2 = plane.Intersects(sphere2);
}