diff --git a/src/BRepFill/BRepFill_Sweep.cxx b/src/BRepFill/BRepFill_Sweep.cxx index 87b9cc9924..3cf8fe5354 100644 --- a/src/BRepFill/BRepFill_Sweep.cxx +++ b/src/BRepFill/BRepFill_Sweep.cxx @@ -1435,13 +1435,17 @@ static TopoDS_Edge BuildEdge(const Handle(Geom_Surface)& S, // Associate 2d Handle(Geom2d_Line) L; TopLoc_Location Loc; + Standard_Real Umin, Umax, Vmin, Vmax; + S->Bounds(Umin, Umax, Vmin, Vmax); if (isUiso) { - gp_Pnt2d P(ValIso, 0); + //gp_Pnt2d P(ValIso, 0); + gp_Pnt2d P( ValIso, Vmin - Iso->FirstParameter() ); gp_Vec2d V(0., 1.); L = new (Geom2d_Line) (P, V); } else { - gp_Pnt2d P(0., ValIso); + //gp_Pnt2d P(0., ValIso); + gp_Pnt2d P( Umin -Iso->FirstParameter() , ValIso ); gp_Vec2d V(1., 0.); L = new (Geom2d_Line) (P, V); } diff --git a/src/GeomFill/GeomFill_Sweep.cxx b/src/GeomFill/GeomFill_Sweep.cxx index 7826d07194..a65f63a3c1 100644 --- a/src/GeomFill/GeomFill_Sweep.cxx +++ b/src/GeomFill/GeomFill_Sweep.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -59,6 +60,7 @@ #include #include #include +#include #include #include @@ -67,6 +69,7 @@ #include #include +#include //======================================================================= //class : GeomFill_Sweep_Eval @@ -843,25 +846,33 @@ static Standard_Boolean IsSweepParallelSpine (const Handle(GeomFill_LocationLaw) Standard_Real f = UFirst , l = ULast; SError = error; Centre.BaryCenter(1.0, C.Location(), 1.0); - gp_Ax3 AxisOfSphere(Centre, DN, DS); - S = new (Geom_SphericalSurface) - (AxisOfSphere, (RotRadius + C.Radius())/2 ); + gp_Ax3 AxisOfSphere(Centre, DN, DS); + gp_Sphere theSphere( AxisOfSphere, (RotRadius + C.Radius())/2 ); + S = new Geom_SphericalSurface(theSphere); // Pour les spheres on ne peut pas controler le parametre // V (donc U car myExchUV = Standard_True) // Il faut donc modifier UFirst, ULast... - if (C.Position().Direction(). - IsOpposite(AxisOfSphere.YDirection(), 0.1) ) { + Standard_Real fpar = AC.FirstParameter(); + Standard_Real lpar = AC.LastParameter(); + Handle(Geom_Curve) theSection = new Geom_TrimmedCurve(Section, fpar, lpar); + theSection->Transform(Tf2); + gp_Pnt FirstPoint = theSection->Value(theSection->FirstParameter()); + gp_Pnt LastPoint = theSection->Value(theSection->LastParameter()); + Standard_Real UfirstOnSec, VfirstOnSec, UlastOnSec, VlastOnSec; + ElSLib::Parameters(theSphere, FirstPoint, UfirstOnSec, VfirstOnSec); + ElSLib::Parameters(theSphere, LastPoint, UlastOnSec, VlastOnSec); + if (VfirstOnSec < VlastOnSec) + { + f = VfirstOnSec; + l = VlastOnSec; + } + else + { // L'orientation parametrique est inversee - l = 2*M_PI - UFirst; - f = 2*M_PI - ULast; + f = VlastOnSec; + l = VfirstOnSec; isUReversed = Standard_True; } - // On calcul le "glissement" parametrique. - Standard_Real rot; - rot = C.Position().XDirection().AngleWithRef - (AxisOfSphere.XDirection(), AxisOfSphere.YDirection()); - f -= rot; - l -= rot; if ( (f >= -M_PI/2) && (l <= M_PI/2)) { Ok = Standard_True; diff --git a/tests/bugs/modalg_5/bug24738 b/tests/bugs/modalg_5/bug24738 new file mode 100644 index 0000000000..4cbda68d28 --- /dev/null +++ b/tests/bugs/modalg_5/bug24738 @@ -0,0 +1,38 @@ +puts "============" +puts "OCC24738" +puts "============" +puts "" +####################################################################### +# BRepOffsetAPI_MakePipe algorithm fails on circular path and section (the case where result is part of sphere) +####################################################################### + +restore [locate_data_file bug24738_path.brep] sp +restore [locate_data_file bug24738_profile.brep] pr + +pipe result sp pr + +set nb_v_good 2 +set nb_e_good 3 +set nb_w_good 1 +set nb_f_good 1 +set nb_sh_good 1 +set nb_sol_good 0 +set nb_compsol_good 0 +set nb_compound_good 0 +set nb_shape_good 8 + +set info [sprops result] + +set string {Center +of +gravity +:[\t\n]*[\s\t]*X +=[\s\t]*([-0-9.+eE]+)[\t\n]*Y +=[\s\t]*([-0-9.+eE]+)[\t\n]*Z +=[\s\t]*([-0-9.+eE]+)[\t\n]*} + +regexp ${string} ${info} full X Y Z + +puts "X=${X}" +puts "Y=${Y}" +puts "Z=${Z}" + +set good_Z 94.9994 + +checkreal "Z" ${Z} ${good_Z} 0.1 0.1 + +set 2dviewer 1