mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
#1985 consolidate and correct shell count checks in tree
This commit is contained in:
+21
-33
@@ -109,18 +109,26 @@ namespace IfcGeom {
|
|||||||
}
|
}
|
||||||
return dss.Value() <= extend;
|
return dss.Value() <= extend;
|
||||||
}
|
}
|
||||||
} else if (completely_within) {
|
|
||||||
BRepAlgoAPI_Cut cut(B, A);
|
|
||||||
if (cut.IsDone()) {
|
|
||||||
if (IfcGeom::Kernel::count(cut.Shape(), TopAbs_SHELL) == 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
BRepAlgoAPI_Common common(A, B);
|
if (IfcGeom::Kernel::count(A, TopAbs_SHELL) == 0 ||
|
||||||
if (common.IsDone()) {
|
IfcGeom::Kernel::count(B, TopAbs_SHELL) == 0)
|
||||||
if (IfcGeom::Kernel::count(common.Shape(), TopAbs_SHELL) > 0) {
|
{
|
||||||
return true;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (completely_within) {
|
||||||
|
BRepAlgoAPI_Cut cut(B, A);
|
||||||
|
if (cut.IsDone()) {
|
||||||
|
if (IfcGeom::Kernel::count(cut.Shape(), TopAbs_SHELL) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
BRepAlgoAPI_Common common(A, B);
|
||||||
|
if (common.IsDone()) {
|
||||||
|
if (IfcGeom::Kernel::count(common.Shape(), TopAbs_SHELL) > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,21 +217,14 @@ namespace IfcGeom {
|
|||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<T> ts_filtered;
|
|
||||||
|
|
||||||
const TopoDS_Shape& A = shapes_.find(t)->second;
|
const TopoDS_Shape& A = shapes_.find(t)->second;
|
||||||
if (IfcGeom::Kernel::count(A, TopAbs_SHELL) == 0) {
|
|
||||||
return ts_filtered;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
std::vector<T> ts_filtered;
|
||||||
ts_filtered.reserve(ts.size());
|
ts_filtered.reserve(ts.size());
|
||||||
|
|
||||||
typename std::vector<T>::const_iterator it = ts.begin();
|
typename std::vector<T>::const_iterator it = ts.begin();
|
||||||
for (it = ts.begin(); it != ts.end(); ++it) {
|
for (it = ts.begin(); it != ts.end(); ++it) {
|
||||||
const TopoDS_Shape& B = shapes_.find(*it)->second;
|
const TopoDS_Shape& B = shapes_.find(*it)->second;
|
||||||
if (IfcGeom::Kernel::count(B, TopAbs_SHELL) == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (test(A, B, completely_within, extend)) {
|
if (test(A, B, completely_within, extend)) {
|
||||||
ts_filtered.push_back(*it);
|
ts_filtered.push_back(*it);
|
||||||
@@ -241,16 +242,7 @@ namespace IfcGeom {
|
|||||||
BRepBndLib::AddClose(s, bb);
|
BRepBndLib::AddClose(s, bb);
|
||||||
bb.SetGap(bb.GetGap() + extend);
|
bb.SetGap(bb.GetGap() + extend);
|
||||||
|
|
||||||
std::vector<T> ts;
|
std::vector<T> ts = select_box(bb, completely_within);
|
||||||
|
|
||||||
if (extend < 0.) {
|
|
||||||
// Shell are only required when we do the boolean based intersection check
|
|
||||||
if (IfcGeom::Kernel::count(s, TopAbs_SHELL) == 0) {
|
|
||||||
return ts;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ts = select_box(bb, completely_within);
|
|
||||||
|
|
||||||
if (ts.empty()) {
|
if (ts.empty()) {
|
||||||
return ts;
|
return ts;
|
||||||
@@ -263,10 +255,6 @@ namespace IfcGeom {
|
|||||||
for (it = ts.begin(); it != ts.end(); ++it) {
|
for (it = ts.begin(); it != ts.end(); ++it) {
|
||||||
const TopoDS_Shape& B = shapes_.find(*it)->second;
|
const TopoDS_Shape& B = shapes_.find(*it)->second;
|
||||||
|
|
||||||
if (IfcGeom::Kernel::count(B, TopAbs_SHELL) == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (test(s, B, completely_within, extend)) {
|
if (test(s, B, completely_within, extend)) {
|
||||||
ts_filtered.push_back(*it);
|
ts_filtered.push_back(*it);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user