本文整理汇总了C++中BoundingBox::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ BoundingBox::empty方法的具体用法?C++ BoundingBox::empty怎么用?C++ BoundingBox::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoundingBox
的用法示例。
在下文中一共展示了BoundingBox::empty方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: expandBy
void BoundingBox::expandBy(const BoundingBox& bbox)
{
if(!bbox.empty()){
if(bbox.min().x() < min_.x()){
min_.x() = bbox.min().x();
}
if(bbox.max().x() > max_.x()){
max_.x() = bbox.max().x();
}
if(bbox.min().y() < min_.y()){
min_.y() = bbox.min().y();
}
if(bbox.max().y() > max_.y()){
max_.y() = bbox.max().y();
}
if(bbox.min().z() < min_.z()){
min_.z() = bbox.min().z();
}
if(bbox.max().z() > max_.z()){
max_.z() = bbox.max().z();
}
if(empty_){
empty_ = (min_.x() >= max_.x()) && (min_.y() >= max_.y()) && (min_.z() >= max_.z());
}
}
}
示例2: intersects
/** Test if @a box intersects this bounding box. */
bool intersects(const BoundingBox& box) const {
if (empty() || box.empty())
return false;
for (unsigned i = 0; i != DIM; ++i)
if (box.min_[i] > max_[i] || box.max_[i] < min_[i])
return false;
return true;
}
示例3: is_valid
/** Helper method to determine if this Iterator is valid. */
bool is_valid() const {
if (s_ == nullptr || bb_.empty())
return false;
if (code_ >= s_->mc_.code(bb_.max())+1)
return false;
if (loc_ >= s_->c2t_[code_].size())
return false;
return bb_.contains(s_->t2p_(s_->c2t_[code_][loc_]));
}
示例4: adjustSize
void PositionDragger::adjustSize(const BoundingBox& bb)
{
if(!bb.empty()){
Vector3 s = bb.size() / 2.0;
std::sort(s.data(), s.data() + 3);
double a = Vector2(s[0], s[1]).norm() * 1.1;
double r = std::max(a, s[2] * 1.2);
setRadius(r);
}
}
示例5: fix
/** Helper method to advance this Iterator until it reaches a valid
* position or end().
*/
void fix() {
assert(s_ != nullptr && !bb_.empty());
if (code_ >= s_->mc_.code(bb_.max())+1) {
// Make equal to end() and return.
code_ = s_->mc_.code(bb_.max())+1;
loc_ = 0;
return;
}
if (loc_ >= s_->c2t_[code_].size() ||
!bb_.contains(s_->t2p_(s_->c2t_[code_][loc_]))) {
operator++();
}
}
示例6: attachPositionDragger
void MeshShapeItemImpl::attachPositionDragger()
{
positionDragger = new ModelEditDragger;
positionDragger->sigDragStarted().connect(boost::bind(&MeshShapeItemImpl::onDraggerStarted, this));
positionDragger->sigPositionDragged().connect(boost::bind(&MeshShapeItemImpl::onDraggerDragged, this));
BoundingBox bb = sceneLink->untransformedBoundingBox();
if (bb.empty()) {
positionDragger->setRadius(0.1);
} else {
positionDragger->adjustSize(sceneLink->untransformedBoundingBox());
}
sceneLink->addChild(positionDragger);
sceneLink->notifyUpdate();
self->notifyUpdate();
}
示例7:
BoundingBoxf::BoundingBoxf(const BoundingBox& org)
{
min_ = org.min().cast<Vector3f::Scalar>();
max_ = org.max().cast<Vector3f::Scalar>();
empty_ = org.empty();
}
示例8: intersects
/** Test if @a box intersects this bounding box. */
bool intersects(const BoundingBox& box) const {
return !empty() && !box.empty()
&& box.min_.x <= max_.x && box.max_.x >= min_.x
&& box.min_.y <= max_.y && box.max_.y >= min_.y
&& box.min_.z <= max_.z && box.max_.z >= min_.z;
}
示例9: contains
/** Test if @a box is entirely within this bounding box.
*
* Returns false if @a box.empty(). */
bool contains(const BoundingBox& box) const {
return !box.empty() && contains(box.min()) && contains(box.max());
}
示例10: end
/** Method to return an iterator pointing to "one past"
* the last item in a given BoundingBox.
*/
iterator end(const BoundingBox& bb) const {
assert(!bb.empty());
return Iterator(this, bb, mc_.code(bb.max())+1, 0);
}
示例11: begin
/** Method to return an iterator pointing to the first item
* in a given BoundingBox.
*/
iterator begin(const BoundingBox& bb) const {
assert(!bb.empty());
return Iterator(this, bb, mc_.code(bb.min()), 0);
}