//=========================================================================== // Bounding box of the entire volume model BoundingBox VolumeModel::boundingBox() //=========================================================================== { BoundingBox box; if (bodies_.size() == 0) return box; box = bodies_[0]->boundingBox(); for (size_t ki=1; ki<bodies_.size(); ++ki) box.addUnionWith(bodies_[ki]->boundingBox()); return box; }
//=========================================================================== // Bounding box of one volume BoundingBox VolumeModel::boundingBox(int idx) const //=========================================================================== { ASSERT(idx < (int)bodies_.size()); BoundingBox box = bodies_[0]->boundingBox(); for (size_t ki=1; ki<bodies_.size(); ++ki) { box.addUnionWith( bodies_[ki]->boundingBox()); } return box; }
//=========================================================================== RectDomain CurveBoundedDomain::containingDomain() const //=========================================================================== { RectDomain dom; if ((*loops_[0])[0]->dimension() == 2) { // We've got a parametric bound BoundingBox b = (*loops_[0])[0]->boundingBox(); int n1 = (int)loops_.size(); int i, j; for (j=0; j<n1; j++) { int n2 = loops_[j]->size(); for (i = (j==0)?1:0; i < n2; ++i) { b.addUnionWith((*loops_[j])[i]->boundingBox()); } } dom = RectDomain(Array<double, 2>(b.low()[0], b.low()[1]), Array<double, 2>(b.high()[0], b.high()[1])); } else { // We should have a bound consisting of CurveOnSurface objects, // and we'll throw an exception if it's not! const CurveOnSurface& cv0 = dynamic_cast<const CurveOnSurface&>(*(*loops_[0])[0]); dom = cv0.containingDomain(); int n1 = (int)loops_.size(); int i, j; for (j=0; j<n1; j++) { int n2 = loops_[j]->size(); for (i = (j==0)?1:0; i < n2; ++i) { const CurveOnSurface& cv1 = dynamic_cast<const CurveOnSurface&>(*(*loops_[j])[i]); dom.addUnionWith(cv1.containingDomain()); } } } return dom; }