Click or drag to resize

AABBIntersectRay Method

返回用户文档首页
检查一条射线是否与轴对齐包围盒(AABB)相交。

Namespace: LoongCAD.Geometry
Assembly: LoongSDKCore (in LoongSDKCore.dll) Version: 0.8.15.0 (0.8.15.0)
Syntax
C#
public bool IntersectRay(
	Vec3 rayPos,
	Vec3 rayDir
)

Parameters

rayPos  Vec3
射线的起点。
rayDir  Vec3
射线的方向,应为单位向量。

Return Value

Boolean
如果射线与包围盒相交,返回 true;否则返回 false。
Remarks
此方法使用射线-盒子相交测试来确定射线是否穿过AABB。首先检查射线起点是否在盒子内部, 然后检查射线与盒子各个面的相交情况。只要发现一处相交,就返回 true。
See Also