1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0023765: The result of section operation contains redundant vertex.

Adding test case for this fix
Modified test cases regarding to 23765
This commit is contained in:
pkv 2013-04-17 15:29:29 +04:00
parent 06be28a4f1
commit 729d84d4f9
5 changed files with 71 additions and 19 deletions

View File

@ -58,6 +58,7 @@
#include <Precision.hxx>
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
//=======================================================================
//function : Draft_Modification
@ -422,23 +423,34 @@ Standard_Boolean Draft_Modification::NewCurve2d(const TopoDS_Edge& E,
(typs == STANDARD_TYPE(Geom_ConicalSurface));
if ( JeRecadre) {
gp_Pnt2d PF,PL;
BRep_Tool::UVPoints(E,F,PF,PL);
gp_Pnt2d NewPF = C->Value(Fp);
gp_Vec2d vectra(2.*M_PI,0.);
if (NewPF.Translated(vectra).SquareDistance(PF)
< NewPF.SquareDistance(PF)) {
C->Translate(vectra);
Standard_Boolean bTranslate;
Standard_Real aD2, aT1, aT2;
gp_Pnt2d PF, NewPF, aP2DT;
gp_Vec2d aV2DT, vectra(2.*M_PI,0.);
Handle(Geom2d_Curve) aC2DE;
//
aC2DE=BRep_Tool::CurveOnSurface(E, F, aT1, aT2);
//
PF=aC2DE->Value(0.5*(aT1+aT2));
//
NewPF=C->Value(0.5*(Fp+Lp));
//
aD2=NewPF.SquareDistance(PF);
//
bTranslate=Standard_False;
if (NewPF.Translated(vectra).SquareDistance(PF) < aD2) {
aV2DT=vectra;
bTranslate=!bTranslate; //True
}
else if (NewPF.Translated(-vectra).SquareDistance(PF)
< NewPF.SquareDistance(PF)) {
C->Translate(-vectra);
else if (NewPF.Translated(-vectra).SquareDistance(PF) < aD2) {
aV2DT=-vectra;
bTranslate=!bTranslate; //True
}
//
if (bTranslate) {
C->Translate(aV2DT);
}
}
return Standard_True;
}

View File

@ -735,6 +735,7 @@ void IntTools_LineConstructor::TreatCircle(const Handle(IntPatch_Line)& aLine,
return;
}
//----------------------------------------
Standard_Boolean bFound;
Standard_Integer aNbVtx, aNbVtxWas, i;
Standard_Real aTolPC, aT, aT1, aT2, aTmid, aTwoPI, aTolPC1;
Standard_Real aU1, aV1, aU2, aV2;
@ -747,6 +748,7 @@ void IntTools_LineConstructor::TreatCircle(const Handle(IntPatch_Line)& aLine,
aTwoPI=M_PI+M_PI;
aTolPC=Precision::PConfusion();
aNbVtxWas=GeomInt_LineTool::NbVertex(aLine);
aNbVtx=aNbVtxWas+2;
//-------------------------------------2
aTS1=myHS1->GetType();
@ -761,7 +763,7 @@ void IntTools_LineConstructor::TreatCircle(const Handle(IntPatch_Line)& aLine,
pVtx=new IntTools_RealWithFlag [aNbVtx];
//
pVtx[0].SetValue(0.);
pVtx[1].SetValue(2.*M_PI);
pVtx[1].SetValue(aTwoPI);
//
for(i=1; i<=aNbVtxWas; ++i) {
aT=GeomInt_LineTool::Vertex(aLine, i).ParameterOnLine();
@ -775,6 +777,27 @@ void IntTools_LineConstructor::TreatCircle(const Handle(IntPatch_Line)& aLine,
//
RejectDuplicates(aNbVtx, pVtx, aTolPC);
//
if ((aType==IntPatch_Circle || aType==IntPatch_Ellipse)&& aNbVtx>2) { // zz
bFound=Standard_False;
for(i=1; i<=aNbVtxWas; ++i) {
aT=GeomInt_LineTool::Vertex(aLine, i).ParameterOnLine();
if (fabs(aT) < aTolPC1 || fabs(aT-aTwoPI) < aTolPC1) {
bFound=!bFound;
break;
}
}
if (!bFound) {
aT=pVtx[1].Value()+aTwoPI;
pVtx[aNbVtx-1].SetValue(aT);
//
for(i=0; i<aNbVtx; ++i) {
aT=pVtx[i+1].Value();
pVtx[i].SetValue(aT);
}
--aNbVtx;
}
}
//
for(i=0; i<aNbVtx-1; ++i) {
aT1=pVtx[i].Value();
aT2=pVtx[i+1].Value();

17
tests/bugs/modalg_4/bug23765 Executable file
View File

@ -0,0 +1,17 @@
puts "========="
puts "CR23765"
puts "========="
puts ""
##################################################
## The result of section operation contains redundant vertex.
##################################################
restore [locate_data_file bug23765_b1.brep] b1
restore [locate_data_file bug23765_b2.brep] b2
bop b1 b2
bopsection result
set nb_v_good 2
set 2dviewer 1

View File

@ -26,7 +26,7 @@ if {${rc1} < 0.} {
} else {
puts "Good value of parametric range rc1"
}
if {${rc2} > ${2_PI}} {
if {${rc2} < ${2_PI}} {
puts "Error: Bad value of parametric range rc2"
} else {
puts "Good value of parametric range rc2"

View File

@ -21,14 +21,14 @@ puts "Finish boolean operation ..."
set square 225009
# Analysis of "nbshapes result"
set nb_v_good 8
set nb_e_good 12
set nb_v_good 6
set nb_e_good 10
set nb_w_good 8
set nb_f_good 6
set nb_sh_good 1
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1
set nb_shape_good 36
set nb_shape_good 32
set 3dviewer 1