本文整理汇总了C++中AABB::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ AABB::contains方法的具体用法?C++ AABB::contains怎么用?C++ AABB::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AABB
的用法示例。
在下文中一共展示了AABB::contains方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
inline bool operator()( const AABB & aabb )
{
for( auto it = points_.begin(); it != points_.end(); ++it )
if( aabb.contains( *it ) )
return true;
return false;
}
示例2: getContainment
float KRReverbZone::getContainment(const Vector3 &pos)
{
AABB bounds = getBounds();
if(bounds.contains(pos)) {
Vector3 size = bounds.size();
Vector3 diff = pos - bounds.center();
diff = diff * 2.0f;
diff = Vector3::Create(diff.x / size.x, diff.y / size.y, diff.z / size.z);
float d = diff.magnitude();
if(m_gradient_distance <= 0.0f) {
// Avoid division by zero
d = d > 1.0f ? 0.0f : 1.0f;
} else {
d = (1.0f - d) / m_gradient_distance;
d = KRCLAMP(d, 0.0f, 1.0f);
}
return d;
} else {
return 0.0f;
}
}
示例3:
std::vector< Data<T> > Quadtree<T>::queryRange(AABB range) const
{
std::vector< Data<T> > pInRange = std::vector< Data<T> >();
if (!boundary.intersects(range))
{
return pInRange;
}
for (int i = 0; i < objects.size(); i++)
{
if (range.contains(objects.at(i).pos))
{
pInRange.push_back(objects.at(i));
}
}
if (nw == nullptr)
{
return pInRange;
}
std::vector< Data<T> > temp = nw->queryRange(range);
pInRange.insert(pInRange.end(), temp.begin(), temp.end());
temp = ne->queryRange(range);
pInRange.insert(pInRange.end(), temp.begin(), temp.end());
temp = sw->queryRange(range);
pInRange.insert(pInRange.end(), temp.begin(), temp.end());
temp = se->queryRange(range);
pInRange.insert(pInRange.end(), temp.begin(), temp.end());
return pInRange;
}
示例4: if
//.........这里部分代码省略.........
current=current->getRight();
continue;
}
KdTreeNode* left = current->getLeft();
current = current->getRight();
nodeStack.push_back( left );
}
}
// Then we found an near leaf, find if there is intersect
ObjectNode* objList = current->getObjectList();
minT = POS_INF;
while( objList )
{
SceneObject* curObj =objList->getObject();
Matrix4x4 invCompMat = (*curObj).m_invTransform;
Vector4 eyePosObjSpace = invCompMat*eyePos;
Vector4 dObjSpace = invCompMat*d;
REAL t = doIntersect( *curObj, eyePosObjSpace, dObjSpace, tempFaceIndex);
if( t>0 && t < minT )
{
minT = t;
objectIndex = curObj->m_arrayID;
faceIndex = tempFaceIndex;
}
objList = objList->getNext();
}
Vector4 dst = (eyePos + minT*d);
// Here we need to enlarge the bounding box a little bit
AABB curBox = AABB( current->getAABB().getPos() - Vector3( EPSILON, EPSILON, EPSILON ),
current->getAABB().getSize() + 2*Vector3( EPSILON, EPSILON, EPSILON ));
if( minT != POS_INF && curBox.contains(Vector3(dst.x, dst.y, dst.z ) ) )
{
resultT = minT;
break;
}
// Else we need to get one node from the stack
if( nodeStack.empty() )
{
// No more nodes, meaning there is no intersect
break;
}
else
{
current = nodeStack.at(nodeStack.size()-1);
nodeStack.pop_back();
}
}
/**
GPU code, preserve for future test
**/
/*
float near, far;
KdTreeNodeHost root = kdnode_test[0];
cl_float4 eye4;
eye4.x = eyePos.x;
eye4.y = eyePos.y;
eye4.z = eyePos.z;
eye4.w = eyePos.w;
cl_float4 d4;
d4.x = d.x;
d4.y = d.y;
d4.z = d.z;
d4.w = d.w;