From 4ff7e6d9321727d4b0d62f0ac7682bf13373fcc1 Mon Sep 17 00:00:00 2001 From: jfa Date: Tue, 11 Apr 2006 08:49:19 +0000 Subject: [PATCH] PAL6839: Problems after scaling degenerated edge. --- src/GEOMImpl/GEOMImpl_ScaleDriver.cxx | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx b/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx index 21824877f..5684bcc71 100644 --- a/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx @@ -27,11 +27,13 @@ #include #include +#include +#include +#include #include #include #include -#include -#include +#include #include #include @@ -77,6 +79,21 @@ Standard_Integer GEOMImpl_ScaleDriver::Execute(TFunction_Logbook& log) const if (aShapeBase.IsNull() || aShapePnt.IsNull()) return 0; if (aShapePnt.ShapeType() != TopAbs_VERTEX) return 0; + // Bug 6839: Check for standalone (not included in faces) degenerated edges + TopTools_IndexedDataMapOfShapeListOfShape aEFMap; + TopExp::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, aEFMap); + Standard_Integer i, nbE = aEFMap.Extent(); + for (i = 1; i <= nbE; i++) { + TopoDS_Shape anEdgeSh = aEFMap.FindKey(i); + if (BRep_Tool::Degenerated(TopoDS::Edge(anEdgeSh))) { + const TopTools_ListOfShape& aFaces = aEFMap.FindFromIndex(i); + if (aFaces.IsEmpty()) + Standard_ConstructionError::Raise + ("Scaling aborted : cannot scale standalone degenerated edge"); + } + } + + // Perform Scaling gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); gp_Trsf aTrsf; aTrsf.SetScale(aP, aCI.GetFactor()); @@ -87,6 +104,9 @@ Standard_Integer GEOMImpl_ScaleDriver::Execute(TFunction_Logbook& log) const if (aShape.IsNull()) return 0; + if (!BRepAlgo::IsValid(aShape)) + Standard_ConstructionError::Raise("Scaling aborted : non valid shape result"); + aFunction->SetValue(aShape); log.SetTouched(Label()); -- 2.39.2