本文整理汇总了C++中BoundingBox::expandBy方法的典型用法代码示例。如果您正苦于以下问题:C++ BoundingBox::expandBy方法的具体用法?C++ BoundingBox::expandBy怎么用?C++ BoundingBox::expandBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoundingBox
的用法示例。
在下文中一共展示了BoundingBox::expandBy方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeBound
BoundingSphere Group::computeBound() const
{
BoundingSphere bsphere;
if (_children.empty())
{
return bsphere;
}
// note, special handling of the case when a child is an Transform,
// such that only Transforms which are relative to their parents coordinates frame (i.e this group)
// are handled, Transform relative to and absolute reference frame are ignored.
BoundingBox bb;
bb.init();
NodeList::const_iterator itr;
for(itr=_children.begin();
itr!=_children.end();
++itr)
{
osg::Node* child = itr->get();
const osg::Transform* transform = child->asTransform();
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_RF)
{
osg::Drawable* drawable = child->asDrawable();
if (drawable)
{
bb.expandBy(drawable->getBoundingBox());
}
else
{
const osg::BoundingSphere& bs = child->getBound();
bb.expandBy(bs);
}
}
}
if (!bb.valid())
{
return bsphere;
}
bsphere._center = bb.center();
bsphere._radius = 0.0f;
for(itr=_children.begin();
itr!=_children.end();
++itr)
{
osg::Node* child = itr->get();
const osg::Transform* transform = child->asTransform();
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_RF)
{
const BoundingSphere& bs = child->getBound();
bsphere.expandRadiusBy(bs);
}
}
return bsphere;
}
示例2: intersectTetrahedron
bool BezierCurve::intersectTetrahedron(unsigned icomponent, const Vector3F * tet)
{
BoundingBox tbox;
tbox.expandBy(tet[0]);
tbox.expandBy(tet[1]);
tbox.expandBy(tet[2]);
tbox.expandBy(tet[3]);
BezierSpline sp;
getSegmentSpline(icomponent, sp);
return intersectTetrahedron(sp, tet, tbox);
}
示例3: intersectTetrahedron
bool BccLattice::intersectTetrahedron(const Vector3F * tet, BezierSpline * splines, unsigned numSplines) const
{
unsigned i = 0;
for(; i<numSplines; i++) {
BoundingBox tbox;
tbox.expandBy(tet[0]);
tbox.expandBy(tet[1]);
tbox.expandBy(tet[2]);
tbox.expandBy(tet[3]);
if(BezierCurve::intersectTetrahedron(splines[i], tet, tbox))
return true;
}
return false;
}
示例4: addAnchorByThreshold
void BlockBccMeshBuilder::addAnchorByThreshold(ATetrahedronMesh * mesh,
unsigned istripe,
const Matrix33F & invspace,
const Vector3F & center,
float threshold,
bool isLower,
unsigned tri)
{
unsigned tetMax = mesh->numTetrahedrons() * 4;
if(istripe < indexDrifts.size() -1)
tetMax = indexDrifts[istripe + 1];
BoundingBox box;
Vector3F q;
unsigned i = indexDrifts[istripe];
unsigned j;
for(;i<tetMax;i+=4) {
unsigned * tet = mesh->tetrahedronIndices(i/4);
box.reset();
for(j=0; j< 4; j++)
box.expandBy(mesh->points()[tet[j]], 1e-3f);
q = invspace.transform(box.center() - center);
if(isLower) {
if(q.x > threshold) continue;
}
else {
if(q.x < threshold) continue;
}
for(j=0; j< 4; j++)
mesh->anchors()[tet[j]] = (1<<24 | tri);
}
}
示例5: u
const std::deque<Vector3F> RayMarch::touched(const float & threshold, BoundingBox & limit) const
{
std::deque<Vector3F> r;
const Vector3F u(threshold, threshold, threshold);
const Vector3F p0 = m_path.m_origin - u;
const Vector3F p1 = m_path.m_origin + u;
const int ng = threshold * 2.f / m_gridSize + 1;
int i, j, k;
Vector3F p;
for(k= 0; k <= ng; k++) {
p.z = p0.z + m_gridSize * k;
for(j= 0; j <= ng; j++) {
p.y = p0.y + m_gridSize * j;
for(i= 0; i <= ng; i++) {
p.x = p0.x + m_gridSize * i;
if(m_limit.isPointInside(p)) r.push_back(p);
}
}
}
const BoundingBox blo = computeBBox(p0);
const BoundingBox bhi = computeBBox(p1);
limit.reset();
limit.expandBy(blo);
limit.expandBy(bhi);
limit.shrinkBy(m_limit);
return r;
}
示例6: calculateBBox
const BoundingBox BezierCurve::calculateBBox() const
{
BoundingBox b;
const unsigned ns = numSegments();
for(unsigned i=0; i < ns; i++)
b.expandBy(calculateBBox(i));
return b;
}
示例7: computeBound
BoundingSphere Patch::computeBound() const
{
BoundingSphere bsphere;
if (!_trile[0][0].valid())
return bsphere;
BoundingBox bb;
bb.init();
for (int res = 0; res < 2; ++res)
for (int i = 0; i < 4; ++i)
bb.expandBy(_trile[res][i]->getBoundingBox());
for (int strip = 0; strip < 4; ++strip)
for (int i = 0; i < 4; ++i)
bb.expandBy(_strip[strip][i]->getBoundingBox());
if (!bb.valid())
return bsphere;
bsphere.expandBy(bb);
return bsphere;
}
示例8: adjustSize
void PositionDragger::adjustSize()
{
BoundingBox bb;
for(int i=0; i < numChildren(); ++i){
SgNode* node = child(i);
if(node != translationDragger_ && node != rotationDragger_){
bb.expandBy(node->boundingBox());
}
}
adjustSize(bb);
}
示例9: intersectBox
bool BezierCurve::intersectBox(BezierSpline & spline, const BoundingBox & box)
{
BoundingBox abox;
spline.getAabb(&abox);
if(!abox.intersect(box)) return false;
if(abox.inside(box)) return true;
BezierSpline stack[64];
int stackSize = 2;
spline.deCasteljauSplit(stack[0], stack[1]);
while(stackSize > 0) {
BezierSpline c = stack[stackSize - 1];
stackSize--;
abox.reset();
abox.expandBy(c.cv[0]);
abox.expandBy(c.cv[1]);
abox.expandBy(c.cv[2]);
abox.expandBy(c.cv[3]);
if(abox.inside(box)) return true;
if(abox.intersect(box)) {
if(abox.area() < 0.0001f) return true;
BezierSpline a, b;
c.deCasteljauSplit(a, b);
stack[ stackSize ] = a;
stackSize++;
stack[ stackSize ] = b;
stackSize++;
}
}
return false;
}
示例10: computeBound
BoundingBox DrawPixels::computeBound() const
{
// really needs to be dependent of view position and projection... will implement simple version right now.
BoundingBox bbox;
float diagonal = 0.0f;
if (_useSubImage)
{
diagonal = sqrtf(_width*_width+_height*_height);
}
else
{
diagonal = sqrtf(_image->s()*_image->s()+_image->t()*_image->t());
}
bbox.expandBy(_position-osg::Vec3(diagonal,diagonal,diagonal));
bbox.expandBy(_position+osg::Vec3(diagonal,diagonal,diagonal));
return bbox;
}
示例11: computeBound
BoundingSphere Switch::computeBound() const
{
BoundingSphere bsphere;
if (_children.empty())
{
return bsphere;
}
// note, special handling of the case when a child is an Transform,
// such that only Transforms which are relative to their parents coordinates frame (i.e this group)
// are handled, Transform relative to and absolute reference frame are ignored.
BoundingBox bb;
bb.init();
for(unsigned int pos=0;pos<_children.size();++pos)
{
const osg::Transform* transform = _children[pos]->asTransform();
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_RF)
{
if( _values[pos] == true )
bb.expandBy(_children[pos]->getBound());
}
}
if (!bb.valid())
{
return bsphere;
}
bsphere._center = bb.center();
bsphere._radius = 0.0f;
for(unsigned int pos=0;pos<_children.size();++pos)
{
const osg::Transform* transform = _children[pos]->asTransform();
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_RF)
{
if( _values[pos] == true )
bsphere.expandRadiusBy(_children[pos]->getBound());
}
}
return bsphere;
}
示例12: computeBound
BoundingSphere OccluderNode::computeBound() const
{
BoundingSphere bsphere(Group::computeBound());
if (getOccluder())
{
BoundingBox bb;
const ConvexPlanarPolygon::VertexList& vertexList = getOccluder()->getOccluder().getVertexList();
for(ConvexPlanarPolygon::VertexList::const_iterator itr=vertexList.begin();
itr!=vertexList.end();
++itr)
{
bb.expandBy(*itr);
}
if (bb.valid())
{
bsphere.expandBy(bb);
}
}
return bsphere;
}