mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 09:32:37 +00:00
#671 api in faceset_helper to obtain multiple bounds from single loop in case of intersections
This commit is contained in:
@@ -151,6 +151,7 @@ private:
|
|||||||
bool edge(int A, int B, TopoDS_Edge& e);
|
bool edge(int A, int B, TopoDS_Edge& e);
|
||||||
|
|
||||||
bool wire(const LP& loop, TopoDS_Wire& wire);
|
bool wire(const LP& loop, TopoDS_Wire& wire);
|
||||||
|
bool wires(const LP& loop, TopTools_ListOfShape& wires);
|
||||||
};
|
};
|
||||||
|
|
||||||
double deflection_tolerance;
|
double deflection_tolerance;
|
||||||
|
|||||||
@@ -243,10 +243,21 @@ bool IfcGeom::Kernel::faceset_helper<CP, LP>::edge(int A, int B, TopoDS_Edge& e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename CP, typename LP>
|
template <typename CP, typename LP>
|
||||||
bool IfcGeom::Kernel::faceset_helper<CP, LP>::wire(const LP& loop, TopoDS_Wire& wire) {
|
bool IfcGeom::Kernel::faceset_helper<CP, LP>::wire(const LP& loop, TopoDS_Wire& w) {
|
||||||
|
TopTools_ListOfShape ws;
|
||||||
|
if (!wires(loop, ws)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
util::select_largest(ws, w);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename CP, typename LP>
|
||||||
|
bool IfcGeom::Kernel::faceset_helper<CP, LP>::wires(const LP& loop, TopTools_ListOfShape& wires) {
|
||||||
if (duplicates_.find(util::conditional_address_of(loop)) != duplicates_.end()) {
|
if (duplicates_.find(util::conditional_address_of(loop)) != duplicates_.end()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
TopoDS_Wire wire;
|
||||||
BRep_Builder builder;
|
BRep_Builder builder;
|
||||||
builder.MakeWire(wire);
|
builder.MakeWire(wire);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -264,10 +275,12 @@ bool IfcGeom::Kernel::faceset_helper<CP, LP>::wire(const LP& loop, TopoDS_Wire&
|
|||||||
wire.Closed(true);
|
wire.Closed(true);
|
||||||
|
|
||||||
TopTools_ListOfShape results;
|
TopTools_ListOfShape results;
|
||||||
if (kernel_->getValue(GV_NO_WIRE_INTERSECTION_CHECK) == 0. && util::wire_intersections(wire, results, kernel_->get_wire_intersection_tolerance(wire), kernel_->getValue(IfcGeom::Kernel::GV_PRECISION))) {
|
if (kernel_->getValue(GV_NO_WIRE_INTERSECTION_CHECK) < 0. && util::wire_intersections(wire, results, kernel_->get_wire_intersection_tolerance(wire), kernel_->getValue(IfcGeom::Kernel::GV_PRECISION))) {
|
||||||
Logger::Warning("Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
|
Logger::Warning("Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
|
||||||
util::select_largest(results, wire);
|
|
||||||
non_manifold_ = true;
|
non_manifold_ = true;
|
||||||
|
wires = results;
|
||||||
|
} else {
|
||||||
|
wires.Append(wire);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user