1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-01 17:36:21 +03:00

0030781: Sweep algorithm creates non-planar edges (orig. BOPAlgo_MakerVolume fails to build a solid)

BRepFill/BRepFill_AdvancedEvolved.cxx - estimation of angular tolerance is added in method GetLids()

tests/evolved/voluved/bug30781 - new test added
This commit is contained in:
ifv 2022-12-02 11:47:37 +03:00 committed by Vadim Glukhikh
parent 669e0dfc17
commit 195a068c4f
2 changed files with 31 additions and 3 deletions

View File

@ -44,6 +44,8 @@
#include <BRepGProp_Face.hxx>
#include <BRep_TEdge.hxx>
#include <ShapeUpgrade_UnifySameDomain.hxx>
#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
#ifdef BRepFill_AdvancedEvolved_DEBUG
#include <BinTools.hxx>
@ -524,9 +526,14 @@ void BRepFill_AdvancedEvolved::GetLids()
return;
}
Standard_Real aTol = Max(aFS.Tolerance(), aFS.ToleranceReached());
aTol += myFuzzyValue;
Bnd_Box aProfBox;
BRepBndLib::Add(myProfile, aProfBox);
Standard_Real aSqDiag = aProfBox.SquareExtent();
//Square of the default angular tolerance in
//BOPAlgo_Tools::EdgesToWires(...) and BOPAlgo_Tools::WiresToFaces(...) methods
const Standard_Real aSqAnguarTol = 1.0e-16;
const Standard_Real aSqAnguarTol = aTol*aTol / aSqDiag;
const gp_Dir &aNormal = aSurf->Position().Direction();
// Obtain free-edges from myPipeShell. All edges must be planar
@ -541,6 +548,7 @@ void BRepFill_AdvancedEvolved::GetLids()
gp_Pnt aPtmp;
gp_Vec aTan;
Standard_Real aDPMax = 0.;
for (Standard_Integer i = 1; i <= aMapEF.Size(); i++)
{
TopTools_ListOfShape& aListF = aMapEF(i);
@ -564,6 +572,8 @@ void BRepFill_AdvancedEvolved::GetLids()
continue;
const Standard_Real aDP = aTan.XYZ().Dot(aNormal.XYZ());
if (Abs(aDP) > aDPMax)
aDPMax = Abs(aDP);
if (aDP*aDP>aSqModulus*aSqAnguarTol)
{
//Only planar edges are considered
@ -594,8 +604,9 @@ void BRepFill_AdvancedEvolved::GetLids()
aBB.MakeCompound(aCompW);
aBB.MakeCompound(aCompF);
aBB.MakeCompound(myTopBottom);
BOPAlgo_Tools::EdgesToWires(aFreeEdges, aCompW, Standard_True);
BOPAlgo_Tools::WiresToFaces(aCompW, aCompF);
Standard_Real anAngTol = Sqrt(aSqAnguarTol);
BOPAlgo_Tools::EdgesToWires(aFreeEdges, aCompW, Standard_True, anAngTol);
BOPAlgo_Tools::WiresToFaces(aCompW, aCompF, anAngTol);
{
// Check orientation

View File

@ -0,0 +1,17 @@
puts "##################################################"
puts "0030781: Sweep algorithm creates non-planar edges (orig. BOPAlgo_MakerVolume fails to build a solid)"
puts "##################################################"
binrestore [locate_data_file bug30781.bin] s
explode s
evolved result -s s_1 -p s_2 -solid -a -v -t 1.e-6
checkshape result
checknbshapes result -vertex 24 -edge 38 -wire 14 -face 14
checkprops result -s 41330.7
smallview
don result
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png