本文整理汇总了C++中AlignedBox::GetVertices方法的典型用法代码示例。如果您正苦于以下问题:C++ AlignedBox::GetVertices方法的具体用法?C++ AlignedBox::GetVertices怎么用?C++ AlignedBox::GetVertices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AlignedBox
的用法示例。
在下文中一共展示了AlignedBox::GetVertices方法的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: Plane
Frustum::Frustum(const AlignedBox& b)
{
V_Vector3 v;
b.GetVertices(v);
//top 3047
top = Plane(v[3], (v[3] - v[0]).Cross(v[4] - v[0]));
//bottom 6512
bottom = Plane(v[6], (v[6] - v[5]).Vector3::Cross(v[1] - v[5]));
//left 6237
left = Plane(v[6], (v[6] - v[2]).Vector3::Cross(v[3] - v[2]));
//right 1540
right = Plane(v[1], (v[1] - v[5]).Cross(v[4] - v[5]));
//front 2103
front = Plane(v[2], (v[2] - v[1]).Cross(v[0] - v[1]));
//back 5674
back = Plane(v[5], (v[5] - v[6]).Cross(v[7] - v[6]));
}
示例3: Contains
bool Frustum::Contains(const AlignedBox& box) const
{
MATH_FUNCTION_TIMER();
V_Vector3 verts;
box.GetVertices(verts);
for (size_t i=0; i<verts.size(); i++)
{
// for each plane
for (i32 j=0; j<6; j++)
{
const Plane& p = (*this)[j];
// we need this vert to be above each plane
if ((verts[i].x * p.A()) + (verts[i].y * p.B()) + (verts[i].z * p.C()) + p.D() < 0)
{
return false;
}
}
}
return true;
}