本文整理汇总了C++中AABB::HalfDiagonal方法的典型用法代码示例。如果您正苦于以下问题:C++ AABB::HalfDiagonal方法的具体用法?C++ AABB::HalfDiagonal怎么用?C++ AABB::HalfDiagonal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AABB
的用法示例。
在下文中一共展示了AABB::HalfDiagonal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Intersects
/// Set Christer Ericson's Real-Time Collision Detection, p.164.
bool Plane::Intersects(const AABB &aabb) const
{
float3 c = aabb.CenterPoint();
float3 e = aabb.HalfDiagonal();
// Compute the projection interval radius of the AABB onto L(t) = aabb.center + t * plane.normal;
float r = e[0]*Abs(normal[0]) + e[1]*Abs(normal[1]) + e[2]*Abs(normal[2]);
// Compute the distance of the box center from plane.
float s = Dot(normal, c) - d;
return Abs(s) <= r;
}
示例2: Intersects
/// The Plane-AABB intersection is implemented according to Christer Ericson's Real-Time Collision Detection, p.164. [groupSyntax]
bool Plane::Intersects(const AABB &aabb) const
{
vec c = aabb.CenterPoint();
vec e = aabb.HalfDiagonal();
// Compute the projection interval radius of the AABB onto L(t) = aabb.center + t * plane.normal;
float r = e[0]*Abs(normal[0]) + e[1]*Abs(normal[1]) + e[2]*Abs(normal[2]);
// Compute the distance of the box center from plane.
// float s = Dot(normal, c) - d;
float s = Dot(normal.xyz(), c.xyz()) - d; ///\todo Use the above form when Plane is SSE'ized.
return Abs(s) <= r;
}