本文整理汇总了C++中AlignedBox::Center方法的典型用法代码示例。如果您正苦于以下问题:C++ AlignedBox::Center方法的具体用法?C++ AlignedBox::Center怎么用?C++ AlignedBox::Center使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AlignedBox
的用法示例。
在下文中一共展示了AlignedBox::Center方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IntersectsBox
bool Frustum::IntersectsBox(const AlignedBox& box, bool precise) const
{
MATH_FUNCTION_TIMER();
if ( fabs((box.maximum - box.minimum).Length()) < LinearIntersectionError )
{
return IntersectsPoint( box.Center() );
}
else
{
f32 m, n;
Vector3 c = box.Center();
Vector3 d = box.maximum - c;
for (i32 i=0; i<6; i++)
{
const Plane& p = (*this)[i];
m = (c.x * p.A()) + (c.y * p.B()) + (c.z * p.C()) + p.D();
n = (d.x * abs(p.A())) + (d.y * abs(p.B())) + (d.z * abs(p.C()));
if (m + n < 0)
{
return false;
}
}
if ( precise )
{
#pragma TODO("This precise test should be using separated axis testing instead of triangle decimation")
V_Vector3 vertices;
vertices.reserve(8);
box.GetVertices(vertices);
V_Vector3 triangleList;
triangleList.reserve(36);
AlignedBox::GetTriangulated(vertices, triangleList);
for ( int i=0; i<36; i+=3 )
{
if ( IntersectsTriangle( triangleList[i], triangleList[i+1], triangleList[i+2] ) )
{
return true;
}
}
return false;
}
}
return true;
}
示例2: AddHitBox
bool FrustumPickVisitor::AddHitBox(const AlignedBox& box)
{
// allocate a hit
PickHit* hit = AddHit();
// our intersection point is the center point (HACK)
Vector3 intersection (box.Center());
// transform values into world space
m_CurrentWorldTransform.TransformVertex(intersection);
// set intersection in world space (we use FLT_MAX for the distance since the distance is spacial)
if (!HasFlags(PickFlags::IgnoreIntersection))
{
hit->SetIntersection(intersection);
}
return true;
}
示例3: Frame
void Camera::Frame(const AlignedBox& box)
{
SetPivot(box.Center());
SetOffset((box.maximum - box.minimum).Length());
Update(true);
}