bool ModelTreeElement::bestFitModelBounds(const ModelItem& model) const { if (_box.contains(model.getMinimumPoint()) && _box.contains(model.getMaximumPoint())) { int childForMinimumPoint = getMyChildContainingPoint(model.getMinimumPoint()); int childForMaximumPoint = getMyChildContainingPoint(model.getMaximumPoint()); // If I contain both the minimum and maximum point, but two different children of mine // contain those points, then I am the best fit for that model if (childForMinimumPoint != childForMaximumPoint) { return true; } } return false; }
bool ModelTreeElement::bestFitModelBounds(const ModelItem& model) const { glm::vec3 clampedMin = glm::clamp(model.getMinimumPoint(), 0.0f, 1.0f); glm::vec3 clampedMax = glm::clamp(model.getMaximumPoint(), 0.0f, 1.0f); if (_box.contains(clampedMin) && _box.contains(clampedMax)) { int childForMinimumPoint = getMyChildContainingPoint(clampedMin); int childForMaximumPoint = getMyChildContainingPoint(clampedMax); // if this is a really small box, then it's close enough! if (_box.getScale() <= SMALLEST_REASONABLE_OCTREE_ELEMENT_SCALE) { return true; } // If I contain both the minimum and maximum point, but two different children of mine // contain those points, then I am the best fit for that model if (childForMinimumPoint != childForMaximumPoint) { return true; } } return false; }
bool ModelTreeElement::containsModelBounds(const ModelItem& model) const { return _box.contains(model.getMinimumPoint()) && _box.contains(model.getMaximumPoint()); }
bool ModelTreeElement::containsModelBounds(const ModelItem& model) const { glm::vec3 clampedMin = glm::clamp(model.getMinimumPoint(), 0.0f, 1.0f); glm::vec3 clampedMax = glm::clamp(model.getMaximumPoint(), 0.0f, 1.0f); return _box.contains(clampedMin) && _box.contains(clampedMax); }