mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
IfcGeom::util::is_manifold not to consider circles as manifold #4283
Investigating I've found that SvgSerializer with prefiltering enabled (after #3359) was ignoring representations that consisted only of a circle curves since it was considered manifold by `IfcGeom::util::is_manifold(s)` in https://github.com/IfcOpenShell/IfcOpenShell/blob/0e0678b926c34f2c28e69558959d3b29e51a50ec/src/serializers/SvgSerializer.h#L433 and topology explorer `TopExp_Explorer exp(s, TopAbs_FACE)` ignored that shape as it had no faces. IfcGeom::util::is_manifold considered a full circle manifold since it was ignoring edges with `v0.IsSame(v1)` considering them manifold but in case of a full circle, circle is a TopoDS_Edge with both vertices at the same location but it also has a circle curve and I've added check for that.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <gp_GTrsf2d.hxx>
|
||||
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_OffsetSurface.hxx>
|
||||
|
||||
#include <ShapeAnalysis_Curve.hxx>
|
||||
@@ -106,10 +107,17 @@ bool IfcGeom::util::is_manifold(const TopoDS_Shape& a) {
|
||||
|
||||
TopoDS_Vertex v0, v1;
|
||||
TopExp::Vertices(e, v0, v1);
|
||||
const bool degenerate = !v0.IsNull() && !v1.IsNull() && v0.IsSame(v1);
|
||||
|
||||
if (degenerate) {
|
||||
continue;
|
||||
// consider degenerate edges as manifold
|
||||
if (!v0.IsNull() && !v1.IsNull()) {
|
||||
if (v0.IsSame(v1)) {
|
||||
// full circle curves have both verts match but still may be non-manifold
|
||||
double dF, dL;
|
||||
Handle(Geom_Curve) curve = BRep_Tool::Curve(TopoDS::Edge(e), dF, dL);
|
||||
if (curve.IsNull() || dynamic_cast<Geom_Circle*>(curve.get()) == nullptr) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (map.FindFromIndex(i).Extent() != 2) {
|
||||
|
||||
Reference in New Issue
Block a user