本文整理汇总了C++中BoundingBox::getBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ BoundingBox::getBounds方法的具体用法?C++ BoundingBox::getBounds怎么用?C++ BoundingBox::getBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoundingBox
的用法示例。
在下文中一共展示了BoundingBox::getBounds方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BM_BoundingBox
static void BM_BoundingBox(benchmark::State& state) {
while (state.KeepRunning()) {
state.PauseTiming();
const int num_imgs = 36;
DataSetReader dsr(std::string(ASSETS_PATH) + "/squirrel");
auto ds = dsr.load(num_imgs);
for (auto idx = 0; idx < num_imgs; ++idx) {
ds->getCamera(idx).setMask(Binarize(
ds->getCamera(idx).getImage(), cv::Scalar(0, 0, 30)));
}
state.ResumeTiming();
BoundingBox bbox =
BoundingBox(ds->getCamera(0), ds->getCamera((num_imgs / 4) - 1));
auto vc = ret::make_unique<VoxelCarving>(bbox.getBounds(), 128);
}
}
示例2: intersects
// Checks to see if two BoundingBoxes overlap. Assumes axis-aligned edges
bool BoundingBox::intersects(const BoundingBox &other) const
{
return ((_xbox.x0 < other.getBounds().x1 && _xbox.x1 > other.getBounds().x0) &&
(_xbox.y0 < other.getBounds().y1 && _xbox.y1 > other.getBounds().y0) &&
(_xbox.z0 < other.getBounds().z1 && _xbox.z1 > other.getBounds().z0));
}
示例3: intersectBoxes
/*!
* \brief Static function for box intersection. Return false if they do not
* intersect.
*
* \param box_A Bounding box A.
*
* \param box_B Bounding box B.
*
* \param intersection A bounding box that is equivalent to the inersection of
* box A and box B. Box A and B can be provided in any order (the
* intersection of box A with box B is equal to the intersection of box B with
* box A).
*
* \return Return true if the boxes intersect. False if they do not.
*/
bool BoundingBox::intersectBoxes( const BoundingBox& box_A,
const BoundingBox& box_B,
BoundingBox& intersection)
{
Teuchos::Tuple<double,6> bounds_A = box_A.getBounds();
Teuchos::Tuple<double,6> bounds_B = box_B.getBounds();
double x_min, y_min, z_min, x_max, y_max, z_max;
// Test for no overlap in X.
if ( bounds_A[0] > bounds_B[3] || bounds_A[3] < bounds_B[0] )
{
return false;
}
// Test for no overlap in Y.
if ( bounds_A[1] > bounds_B[4] || bounds_A[4] < bounds_B[1] )
{
return false;
}
// Test for no overlap in Z.
if ( bounds_A[2] > bounds_B[5] || bounds_A[5] < bounds_B[2] )
{
return false;
}
// Get overlap in X.
if ( bounds_A[0] > bounds_B[0] )
{
x_min = bounds_A[0];
}
else
{
x_min = bounds_B[0];
}
if ( bounds_A[3] > bounds_B[3] )
{
x_max = bounds_B[3];
}
else
{
x_max = bounds_A[3];
}
// Get overlap in Y.
if ( bounds_A[1] > bounds_B[1] )
{
y_min = bounds_A[1];
}
else
{
y_min = bounds_B[1];
}
if ( bounds_A[4] > bounds_B[4] )
{
y_max = bounds_B[4];
}
else
{
y_max = bounds_A[4];
}
// Get overlap in Z.
if ( bounds_A[2] > bounds_B[2] )
{
z_min = bounds_A[2];
}
else
{
z_min = bounds_B[2];
}
if ( bounds_A[5] > bounds_B[5] )
{
z_max = bounds_B[5];
}
else
{
z_max = bounds_A[5];
}
intersection = BoundingBox( x_min, y_min, z_min, x_max, y_max, z_max );
return true;
}
示例4: drawNode
/**
Draw a tree.
\param node Node
\param draw_blends If true, only objects that use blending are drawn. Otherwise objects with
blending are not drawn.
\return True if the tree contained one or more objects that use blending
*/
bool GLRenderInstance::drawNode(WorldObject& node, bool draw_blends)
{
double M[16];
BoundingBox bb;
vec3d bmin, bmax, t, d;
bool render_flag = true;
bool res = false;
WorldObject::ChildIterator it;
for(it=node.childsBegin(); it!=node.childsEnd(); it++)
{
glPushMatrix();
// Set the local transformation
it->second->localTransform().toList(M);
glMultMatrixd(M);
// Draw the geom (if visible)
boost::shared_ptr<GeomObject> geom = it->second->getGeom();
if (geom.get()!=0 && (it->second->visible.getValue()))
{
// Render by default if draw_blends is false
render_flag = !draw_blends;
// Set material
boost::shared_ptr<Material> mat = it->second->getMaterial();
Material* bmat = dynamic_cast<Material*>(mat.get());
// Check if the object should be postponed because blending is used...
if (bmat!=0)
{
if (bmat->usesBlending())
{
res = true;
render_flag = draw_blends;
}
}
if (render_flag)
{
// Set material
glPushAttrib(GL_LIGHTING_BIT | GL_TEXTURE_BIT);
if (bmat!=0)
{
bmat->applyGL();
}
if (draw_solid)
{
clearGLError();
geom->drawGL();
}
// Draw bounding box
if (draw_bboxes)
{
bb = geom->boundingBox();
if (!bb.isEmpty())
{
glDisable(GL_LIGHTING);
bb.getBounds(bmin, bmax);
t = 0.5*(bmax+bmin);
d = bmax-bmin;
glPushMatrix();
glTranslated(t.x, t.y, t.z);
drawWireCube(d.x, d.y, d.z);
glPopMatrix();
glEnable(GL_LIGHTING);
}
}
glPopAttrib(); // restore material
}
}
// Draw the children
res |= drawNode(*(it->second), draw_blends);
glPopMatrix();
}
return res;
}