From: jfa Date: Tue, 11 Apr 2006 08:49:19 +0000 (+0000) Subject: PAL6839: Problems after scaling degenerated edge. X-Git-Tag: T3_2_0b1_pre1~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4ff7e6d9321727d4b0d62f0ac7682bf13373fcc1;p=modules%2Fgeom.git PAL6839: Problems after scaling degenerated edge. --- 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());