From: ifv Date: Tue, 24 Mar 2020 07:23:46 +0000 (+0300) Subject: 0031460: Modeling Algorithms - Regression: Revolution not done. X-Git-Tag: V7_5_0_beta~248 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=517ba7aa70cf6570e59f57ea51664598ae8e2c99 0031460: Modeling Algorithms - Regression: Revolution not done. BRepPrimAPI_MakeRevol.cxx: check of intersection of edge with rotation axis is improved. Test case added --- diff --git a/src/BRepPrimAPI/BRepPrimAPI_MakeRevol.cxx b/src/BRepPrimAPI/BRepPrimAPI_MakeRevol.cxx index 96aa5ff..a6aed7d 100644 --- a/src/BRepPrimAPI/BRepPrimAPI_MakeRevol.cxx +++ b/src/BRepPrimAPI/BRepPrimAPI_MakeRevol.cxx @@ -252,7 +252,21 @@ void BRepPrimAPI_MakeRevol::Build() static Standard_Boolean IsIntersect(const Handle(Adaptor3d_HCurve)& theC, const gp_Ax1& theAxe) { - const Handle(Geom_Line) aL = new Geom_Line(theAxe); + const gp_Lin anAxis(theAxe); + //Quick test for circle + if (theC->GetType() == GeomAbs_Circle) + { + gp_Circ aCirc = theC->Circle(); + const gp_Pnt& aCentr = aCirc.Location(); + Standard_Real anR2 = aCirc.Radius(); + anR2 -= Precision::Confusion(); + anR2 *= anR2; + if (anAxis.SquareDistance(aCentr) > anR2) + { + return Standard_False; + } + } + const Handle(Geom_Line) aL = new Geom_Line(anAxis); const GeomAdaptor_Curve aLin(aL); const Standard_Real aParTol = theC->Resolution(Precision::Confusion()); const Standard_Real aParF = theC->FirstParameter() + aParTol, diff --git a/tests/bugs/modalg_7/bug31460 b/tests/bugs/modalg_7/bug31460 new file mode 100644 index 0000000..188b852 --- /dev/null +++ b/tests/bugs/modalg_7/bug31460 @@ -0,0 +1,34 @@ +puts "========" +puts "0031460: Modeling Algorithms - Regression: Revolution not done." +puts "========" +puts "" + +circle cir 3 2.9999999999989 0 0 0 -1 -1 0 0 3 +trim cir cir 4.71238898038469 6.28318530717959 +mkedge e cir + +## sector +revol r10 e 0 0 0 1 0 0 10 1 + +if { [isdraw r10] == 1 } { + if { [regexp "valid" [checkshape r10]] && [regexp "OK" [bopcheck r10 4]]} { + puts "OK: valid shape is created" + } else { + puts "Error: algorithm created wrong shape" + } +} else { + puts "Error: algorithm did not create shape" +} + +## full revol +revol r360 e 0 0 0 1 0 0 360 1 + +if { [isdraw r360] == 1 } { + if { [regexp "valid" [checkshape r360]] && [regexp "OK" [bopcheck r360 4]]} { + puts "OK: valid shape is created" + } else { + puts "Error: algorithm created wrong shape" + } +} else { + puts "Error: algorithm did not create shape" +}