mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 11:28:13 +00:00
#2305 fix cone boolean op
This commit is contained in:
@@ -5,6 +5,10 @@
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
|
||||
#include <boost/preprocessor/stringize.hpp>
|
||||
#include <boost/preprocessor/seq/for_each.hpp>
|
||||
|
||||
@@ -258,6 +262,16 @@ bool IfcGeom::Kernel::is_manifold(const TopoDS_Shape& a) {
|
||||
TopExp::MapShapesAndAncestors(a, TopAbs_EDGE, TopAbs_FACE, map);
|
||||
|
||||
for (int i = 1; i <= map.Extent(); ++i) {
|
||||
const TopoDS_Edge& e = TopoDS::Edge(map.FindKey(i));
|
||||
|
||||
TopoDS_Vertex v0, v1;
|
||||
TopExp::Vertices(e, v0, v1);
|
||||
const bool degenerate = !v0.IsNull() && !v1.IsNull() && v0.IsSame(v1);
|
||||
|
||||
if (degenerate) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (map.FindFromIndex(i).Extent() != 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -45,8 +45,18 @@ double IfcGeom::util::min_edge_length(const TopoDS_Shape & a) {
|
||||
double min_edge_len = std::numeric_limits<double>::infinity();
|
||||
TopExp_Explorer exp(a, TopAbs_EDGE);
|
||||
for (; exp.More(); exp.Next()) {
|
||||
const TopoDS_Edge& e = TopoDS::Edge(exp.Current());
|
||||
|
||||
TopoDS_Vertex v0, v1;
|
||||
TopExp::Vertices(e, v0, v1);
|
||||
if (!v0.IsNull() && !v1.IsNull() && v0.IsSame(v1)) {
|
||||
// Don't consider a 3d-degenerate edge (for example cone apex)
|
||||
// in calculating overall shape min edge length.
|
||||
continue;
|
||||
}
|
||||
|
||||
GProp_GProps prop;
|
||||
BRepGProp::LinearProperties(exp.Current(), prop);
|
||||
BRepGProp::LinearProperties(e, prop);
|
||||
double l = prop.Mass();
|
||||
if (l < min_edge_len) {
|
||||
min_edge_len = l;
|
||||
|
||||
Reference in New Issue
Block a user