From a791eb69f45e5ee57f133e36014ecda6d3f76d3d Mon Sep 17 00:00:00 2001 From: jgv Date: Fri, 21 Nov 2014 15:22:22 +0300 Subject: [PATCH] 0025491: BRepOffsetAPI_MakeOffset algorithm crashes on customer's shape and big value of offset Test case for CR25491 Correction of test case for issue CR25491 --- src/BRepFill/BRepFill_OffsetWire.cxx | 35 +++++++--------------------- tests/bugs/modalg_5/bug25298_09 | 12 +++++----- tests/bugs/modalg_5/bug25491 | 32 +++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 32 deletions(-) create mode 100755 tests/bugs/modalg_5/bug25491 diff --git a/src/BRepFill/BRepFill_OffsetWire.cxx b/src/BRepFill/BRepFill_OffsetWire.cxx index 668066f6db..c9ed51900d 100644 --- a/src/BRepFill/BRepFill_OffsetWire.cxx +++ b/src/BRepFill/BRepFill_OffsetWire.cxx @@ -1253,29 +1253,6 @@ void BRepFill_OffsetWire::UpdateDetromp (BRepFill_DataMapOfOrientedShapeListOfSh const Standard_Boolean EOnE, const BRepFill_TrimEdgeTool& Trim) const { - if (myJoinType == GeomAbs_Intersection && - Vertices.Length() == 1 && - !EOnE) - { - TopTools_IndexedMapOfShape Vmap1, Vmap2; - TopExp::MapShapes(Shape1, TopAbs_VERTEX, Vmap1); - TopExp::MapShapes(Shape2, TopAbs_VERTEX, Vmap2); - Standard_Boolean Adjacent = Standard_False; - for (Standard_Integer i = 1; i <= Vmap1.Extent(); i++) - for (Standard_Integer j = 1; j <= Vmap2.Extent(); j++) - if (Vmap1(i).IsSame(Vmap2(j))) - { - Adjacent = Standard_True; - break; - } - if (Adjacent) - { - Detromp(Shape1).Append(Vertices.First()); - Detromp(Shape2).Append(Vertices.First()); - return; - } - } - Standard_Integer ii = 1; Standard_Real U1,U2; TopoDS_Vertex V1,V2; @@ -1294,8 +1271,11 @@ void BRepFill_OffsetWire::UpdateDetromp (BRepFill_DataMapOfOrientedShapeListOfSh U2 = Params.Value(ii).X(); V2 = TopoDS::Vertex(Vertices.Value(ii)); - gp_Pnt2d P = Bis->Value((U2 + U1)*0.5); - if (!Trim.IsInside(P)) { + gp_Pnt2d P = Bis->Value((U2 + U1)*0.5); + Standard_Boolean IsP_inside = Standard_True; + if (myJoinType == GeomAbs_Arc) + IsP_inside = Trim.IsInside(P); + if (!IsP_inside) { if (!V1.IsNull()) { Detromp(Shape1).Append(V1); Detromp(Shape2).Append(V1); @@ -1313,7 +1293,10 @@ void BRepFill_OffsetWire::UpdateDetromp (BRepFill_DataMapOfOrientedShapeListOfSh if (!EOnE) { if (!Precision::IsInfinite(U2)) { gp_Pnt2d P = Bis->Value((U2 + U1)*0.5); - if (!Trim.IsInside(P)) { + Standard_Boolean IsP_inside = Standard_False; + if (myJoinType == GeomAbs_Arc) + IsP_inside = Trim.IsInside(P); + if (!IsP_inside) { if (!V1.IsNull()) { Detromp(Shape1).Append(V1); Detromp(Shape2).Append(V1); diff --git a/tests/bugs/modalg_5/bug25298_09 b/tests/bugs/modalg_5/bug25298_09 index 94f635471d..74eb18f51b 100755 --- a/tests/bugs/modalg_5/bug25298_09 +++ b/tests/bugs/modalg_5/bug25298_09 @@ -17,17 +17,17 @@ if [catch { mkoffset resoffset pp 1 -1. i } ] { } else { renamevar resoffset_1 result - set length 42 + set length 32 - set nb_v_good 6 - set nb_e_good 7 - set nb_w_good 2 + set nb_v_good 5 + set nb_e_good 5 + set nb_w_good 1 set nb_f_good 0 set nb_sh_good 0 set nb_sol_good 0 set nb_compsol_good 0 - set nb_compound_good 1 - set nb_shape_good 16 + set nb_compound_good 0 + set nb_shape_good 11 display result fit diff --git a/tests/bugs/modalg_5/bug25491 b/tests/bugs/modalg_5/bug25491 new file mode 100755 index 0000000000..8a73d20d9b --- /dev/null +++ b/tests/bugs/modalg_5/bug25491 @@ -0,0 +1,32 @@ +puts "============" +puts "OCC25491" +puts "============" +puts "" +####################################################################### +# BRepOffsetAPI_MakeOffset algorithm crashes on customer's shape and big value of offset +####################################################################### + +restore [locate_data_file bug25491_offset_lines_2.brep] a + +if [catch { mkoffset resoffset a 1 -35 i } ] { + puts "Error : mkoffset is wrong" +} else { + renamevar resoffset_1 result + + set length 120 + + set nb_v_good 5 + set nb_e_good 5 + set nb_w_good 1 + set nb_f_good 0 + set nb_sh_good 0 + set nb_sol_good 0 + set nb_compsol_good 0 + set nb_compound_good 0 + set nb_shape_good 11 +} + +smallview +display a +fit +set only_screen_axo 1