Substitute tiny trimmed curves with linear approximation when deflection within tolerance

This commit is contained in:
Thomas Krijnen
2018-12-10 17:15:39 +01:00
parent 327be7030f
commit d3092090df
2 changed files with 74 additions and 11 deletions
+16 -2
View File
@@ -983,8 +983,22 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcSweptDiskSolid* l, TopoDS_Shap
{
gp_Pnt directrix_origin;
gp_Vec directrix_tangent;
TopExp_Explorer exp(wire, TopAbs_EDGE);
TopoDS_Edge edge = TopoDS::Edge(exp.Current());
TopoDS_Edge edge;
// Find first edge
TopoDS_Vertex v0, v1;
TopExp::Vertices(wire, v0, v1);
TopTools_IndexedDataMapOfShapeListOfShape map;
TopExp::MapShapesAndAncestors(wire, TopAbs_VERTEX, TopAbs_EDGE, map);
TopTools_ListOfShape edges;
if (map.FindFromKey(v0, edges) && edges.Extent() == 1) {
edge = TopoDS::Edge(edges.First());
} else {
Logger::Error("Unable to locate first edge of:", l->Directrix()->entity);
return false;
}
double u0, u1;
Handle(Geom_Curve) crv = BRep_Tool::Curve(edge, u0, u1);
crv->D1(u0, directrix_origin, directrix_tangent);