1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0026071: BRepOffsetAPI_MakePipeShell produces rough result

1. Correct building history: the case of closed spine.
2. Rollback method GeomFill_CorrectedFrenet::InitInterval - correct processing singularities on spine.
3. Correct test cases.
This commit is contained in:
jgv 2019-09-06 17:03:59 +03:00 committed by rnv
parent f160ca4ef7
commit a2ac649fd1
9 changed files with 64 additions and 31 deletions

View File

@ -451,7 +451,12 @@ void BRepFill_LocationLaw::CurvilinearBounds(const Standard_Integer Index,
Standard_Boolean BRepFill_LocationLaw::IsClosed() const Standard_Boolean BRepFill_LocationLaw::IsClosed() const
{ {
return myPath.Closed(); if (myPath.Closed())
return Standard_True;
TopoDS_Vertex V1, V2;
TopExp::Vertices(myPath, V1, V2);
return (V1.IsSame(V2));
} }
//======================================================================= //=======================================================================

View File

@ -1377,7 +1377,7 @@ void BRepFill_PipeShell::BuildHistory(const BRepFill_Sweep& theSweep)
BB.Add(aWire, CurEdge); BB.Add(aWire, CurEdge);
} //for (jj = 2; jj <= SeqEdges.Length(); jj++) } //for (jj = 2; jj <= SeqEdges.Length(); jj++)
//case of closed wire //case of closed wire
if (mySection->IsVClosed() && if (myLocation->IsClosed() &&
!CurVertex.IsSame(FirstVertex)) !CurVertex.IsSame(FirstVertex))
{ {
const TopTools_ListOfShape& Elist = VEmap.FindFromKey(CurVertex); const TopTools_ListOfShape& Elist = VEmap.FindFromKey(CurVertex);

View File

@ -247,6 +247,10 @@ static Standard_Integer geompipe(Draw_Interpretor&,
std::cout << "GeomFill_Pipe cannot make a surface" << std::endl; std::cout << "GeomFill_Pipe cannot make a surface" << std::endl;
return 1; return 1;
} }
Standard_Real Accuracy = aPipe.ErrorOnSurf();
std::cout << "Accuracy of approximation = " << Accuracy << std::endl;
Handle(Geom_Surface) Sur = aPipe.Surface(); Handle(Geom_Surface) Sur = aPipe.Surface();
TopoDS_Face F; TopoDS_Face F;
if (!Sur.IsNull()) if (!Sur.IsNull())

View File

@ -475,16 +475,16 @@ Handle(GeomFill_TrihedronLaw) GeomFill_CorrectedFrenet::Copy() const
gp_Vec Tangent, Normal, BN, cross; gp_Vec Tangent, Normal, BN, cross;
TColStd_SequenceOfReal parameters; TColStd_SequenceOfReal parameters;
TColStd_SequenceOfReal EvolAT; TColStd_SequenceOfReal EvolAT;
Standard_Real Param = First, L, norm; Standard_Real Param = First, LengthMin, L, norm;
Standard_Boolean isZero = Standard_True, isConst = Standard_True; Standard_Boolean isZero = Standard_True, isConst = Standard_True;
const Standard_Real minnorm = 1.e-16;
Standard_Integer i; Standard_Integer i;
gp_Pnt PonC; gp_Pnt PonC;
gp_Vec D1; gp_Vec D1;
frenet->SetInterval(First, Last); //To have the rigth evaluation at bounds frenet->SetInterval(First, Last); //To have right evaluation at bounds
GeomFill_SnglrFunc CS(myCurve); GeomFill_SnglrFunc CS(myCurve);
BndLib_Add3dCurve::Add(CS, First, Last, 1.e-2, Boite); BndLib_Add3dCurve::Add(CS, First, Last, 1.e-2, Boite);
LengthMin = Boite.GetGap()*1.e-4;
aT = gp_Vec(0, 0, 0); aT = gp_Vec(0, 0, 0);
aN = gp_Vec(0, 0, 0); aN = gp_Vec(0, 0, 0);
@ -541,21 +541,13 @@ Handle(GeomFill_TrihedronLaw) GeomFill_CorrectedFrenet::Copy() const
//Evaluate the Next step //Evaluate the Next step
CS.D1(Param, PonC, D1); CS.D1(Param, PonC, D1);
L = Max(PonC.XYZ().Modulus()/2, LengthMin);
L = PonC.XYZ().Modulus()/2;
norm = D1.Magnitude(); norm = D1.Magnitude();
if (norm <= gp::Resolution()) if (norm < Precision::Confusion()) {
{ norm = Precision::Confusion();
//norm = 2.*gp::Resolution();
norm = minnorm;
} }
currStep = L / norm; currStep = L / norm;
if (currStep <= gp::Resolution()) //L = 0 => curvature = 0, linear segment if (currStep > Step) currStep = Step;//default value
currStep = Step;
if (currStep < Precision::Confusion()) //too small step
currStep = Precision::Confusion();
if (currStep > Step) //too big step
currStep = Step;//default value
} }
else else
currStep /= 2; // Step too long ! currStep /= 2; // Step too long !

View File

@ -153,6 +153,9 @@ static Standard_Integer sweep (Draw_Interpretor& di,
return 1; return 1;
} }
Standard_Real Accuracy = Pipe.ErrorOnSurf();
di << "Accuracy of approximation = " << Accuracy << "\n";
DrawTrSurf::Set(a[1], Pipe.Surface()); DrawTrSurf::Set(a[1], Pipe.Surface());
return 0; return 0;
@ -223,6 +226,10 @@ static Standard_Integer tuyau (Draw_Interpretor& di,
di << "GeomFill_Pipe cannot make a surface\n"; di << "GeomFill_Pipe cannot make a surface\n";
return 1; return 1;
} }
Standard_Real Accuracy = Pipe.ErrorOnSurf();
di << "Accuracy of approximation = " << Accuracy << "\n";
DrawTrSurf::Set(a[indice_path-1], Pipe.Surface()); DrawTrSurf::Set(a[indice_path-1], Pipe.Surface());
return 0; return 0;

View File

@ -1,10 +1,7 @@
puts "========" puts "============================================================="
puts "OCC25883" puts "OCC25883: BRepOffsetAPI_MakePipeShell produces invalid result"
puts "========" puts "============================================================="
puts "" puts ""
#######################################################
# BRepOffsetAPI_MakePipeShell produces invalid result
#######################################################
restore [locate_data_file OCC25883_shape.brep] a restore [locate_data_file OCC25883_shape.brep] a
@ -16,12 +13,20 @@ mksweep a_1
addsweep a_2 addsweep a_2
buildsweep res buildsweep res
donly res
fit
set bug_info [checkshape res] set bug_info [checkshape res]
if {[string compare $bug_info "This shape seems to be valid"] != 0} { if {[string compare $bug_info "This shape seems to be valid"] != 0} {
puts "ERROR: OCC25883 is reproduced." puts "ERROR: OCC25883 is reproduced."
} }
set tolres [checkmaxtol res]
if { ${tolres} > 1.e-4} {
puts "Error: bad tolerance of result"
}
explode res
mksurface surf2 res_2
donly surf2
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@ -33,4 +33,4 @@ checkprops r4 -s 10944.1
explode pr_1 v explode pr_1 v
generated r3 sweep_hist pr_1_3 generated r3 sweep_hist pr_1_3
checkprops r3 -l 130.036 checkprops r3 -l 65.0179

View File

@ -1,3 +1,5 @@
puts "TODO OCC21413 ALL: bad accuracy of approximation"
puts "========" puts "========"
puts "OCC21413" puts "OCC21413"
puts "========" puts "========"
@ -8,6 +10,12 @@ puts ""
restore [locate_data_file bug21413_dc1_err.draw] a restore [locate_data_file bug21413_dc1_err.draw] a
tuyau result a 1 set log [tuyau result a 1]
regexp {Accuracy of approximation = ([0-9+-.eE]*)} $log full accuracy
if { ${accuracy} > 0.0001} {
puts "Error: bad accuracy of approximation"
}
checkview -display result -2d -path ${imagedir}/${test_image}.png checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@ -1,4 +1,4 @@
puts "TODO OCC23942 ALL: is not equal" puts "TODO OCC21413 ALL: bad accuracy of approximation"
puts "========" puts "========"
puts "OCC23942" puts "OCC23942"
@ -12,7 +12,13 @@ puts ""
### 1 ### 1
# #
interpol c [locate_data_file bug23942_points.txt] interpol c [locate_data_file bug23942_points.txt]
tuyau r_1 c 5 set log [tuyau r_1 c 5]
regexp {Accuracy of approximation = ([0-9+-.eE]*)} $log full accuracy
if { ${accuracy} > 0.0001} {
puts "Error: bad accuracy of approximation"
}
decho off decho off
dlog reset dlog reset
@ -38,7 +44,13 @@ puts "VKnots_1 = ${VKnots_1}"
# #
save c ${imagedir}/cc save c ${imagedir}/cc
restore ${imagedir}/cc restore ${imagedir}/cc
tuyau r_2 cc 5 set log [tuyau r_2 cc 5]
regexp {Accuracy of approximation = ([0-9+-.eE]*)} $log full accuracy
if { ${accuracy} > 0.0001} {
puts "Error: bad accuracy of approximation"
}
decho off decho off
dlog reset dlog reset