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

0026642: ShapeUpgrade_UnifySameDomain introduces extremely high vertex tolerances

Algorithm of computation of safe shift value along 2D-line (in order to distance between two points was less than tolerance) has been improved.

Correction of some test cases in accordance with their new behavior.
This commit is contained in:
nbv 2015-09-15 15:45:57 +03:00 committed by abv
parent 00ffff5c8c
commit 2fc40ae3de
4 changed files with 79 additions and 16 deletions

View File

@ -549,12 +549,12 @@ void DomainIntersection(const IntRes2d_Domain& Domain
if(Domain.HasFirstPoint()) {
if(U1sup < (Domain.FirstParameter()-Domain.FirstTolerance())) {
Res1inf=1; Res1sup=-1;
return;
}
Res1inf=1; Res1sup=-1;
return;
}
if(U1inf>(Domain.FirstParameter()+Domain.FirstTolerance())) {
Res1inf=U1inf;
PosInf=IntRes2d_Middle;
Res1inf=U1inf;
PosInf=IntRes2d_Middle;
}
else {
Res1inf=Domain.FirstParameter();
@ -572,8 +572,8 @@ void DomainIntersection(const IntRes2d_Domain& Domain
return;
}
if(U1sup<(Domain.LastParameter()-Domain.LastTolerance())) {
Res1sup=U1sup;
PosSup=IntRes2d_Middle;
Res1sup=U1sup;
PosSup=IntRes2d_Middle;
}
else {
Res1sup=Domain.LastParameter();
@ -599,9 +599,9 @@ void DomainIntersection(const IntRes2d_Domain& Domain
/*if(PosInf==IntRes2d_Head) {
if(Res1sup <= (Res1inf+Domain.FirstTolerance())) {
Res1sup=Res1inf;
PosSup=IntRes2d_Head;
PosSup=IntRes2d_Head;
}
}
}
if(PosSup==IntRes2d_End) {
if(Res1inf >= (Res1sup-Domain.LastTolerance())) {
Res1inf=Res1sup;
@ -1229,12 +1229,12 @@ void IntCurve_IntConicConic::Perform(const gp_Lin2d& L1
//-- 2 : Confondues a la tolerance pres
Standard_Integer nbsol;
IntRes2d_IntersectionPoint PtSeg1,PtSeg2;
Standard_Real SINL1L2;
Standard_Real aHalfSinL1L2;
Standard_Real Tol = TolR;
if(TolR< 1e-10) Tol = 1e-10;
LineLineGeometricIntersection(L1,L2,Tol,U1,U2,SINL1L2,nbsol);
LineLineGeometricIntersection(L1,L2,Tol,U1,U2,aHalfSinL1L2,nbsol);
gp_Vec2d Tan1=L1.Direction();
gp_Vec2d Tan2=L2.Direction();
@ -1254,7 +1254,7 @@ void IntCurve_IntConicConic::Perform(const gp_Lin2d& L1
//-- d une distance superieure a Tol.
//---------------------------------------------------
IntRes2d_Position Pos1a,Pos2a,Pos1b,Pos2b;
Standard_Real d=Tol/(SINL1L2);
Standard_Real d = 0.5 * Tol / aHalfSinL1L2;
Standard_Real U1inf=U1-d;
Standard_Real U1sup=U1+d;
Standard_Real U1mU2=U1-U2;
@ -1364,7 +1364,7 @@ void IntCurve_IntConicConic::Perform(const gp_Lin2d& L1
if(Res2sup_m_Res2inf < 0.0) {
//-- Pas de solutions On retourne Vide
}
else if(((Res2sup-Res2inf) > LongMiniSeg)
else if((Res2sup_m_Res2inf > LongMiniSeg)
|| ((Pos2a==Pos2b)&&(Pos2a!=IntRes2d_Middle))) {
//----------- Calcul des attributs du segment --------------
//-- Attention, les bornes Res1inf(sup) bougent donc il faut
@ -1657,6 +1657,30 @@ void IntCurve_IntConicConic::Perform(const gp_Lin2d& L1
}
}
}
//#ifdef OCCT_DEBUG
// if (NbPoints() || NbSegments())
// {
// static int cnt = 0; cnt++;
//
// printf("line l1_%03d %.15g %.15g %.15g %.15g\n", cnt, L1.Location().X(), L1.Location().Y(), L1.Direction().X(), L1.Direction().Y());
//
// if (Domain1.HasFirstPoint() && Domain1.HasLastPoint())
// printf("trim l1_%03d l1_%03d %.15g %.15g\n", cnt, cnt, Domain1.FirstParameter(), Domain1.LastParameter());
//
// printf("line l2_%03d %.15g %.15g %.15g %.15g\n", cnt, L2.Location().X(), L2.Location().Y(), L2.Direction().X(), L2.Direction().Y());
//
// if (Domain2.HasFirstPoint() && Domain2.HasLastPoint())
// printf("trim l2_%03d l2_%03d %.15g %.15g\n", cnt, cnt, Domain2.FirstParameter(), Domain2.LastParameter());
//
// for (int i=1; i <= NbPoints(); i++)
// printf("point p%d_%03d %.15g %.15g\n", i, cnt, Point(i).Value().X(), Point(i).Value().Y());
//
// for (int i=1; i <= NbSegments(); i++)
// printf("point s1_%d_%03d %.15g %.15g; point s2_%d_%03d %.15g %.15g\n", i, cnt, Segment(i).FirstPoint().Value().X(), Segment(i).FirstPoint().Value().Y(), i, cnt, Segment(i).LastPoint().Value().X(), Segment(i).LastPoint().Value().Y());
// }
//#endif
}
else {
if(nbsol==2) { //== Droites confondues a la tolerance pres

View File

@ -3,6 +3,7 @@
puts "TODO OCC26020 ALL: Error: bopcheck failed"
puts "TODO OCC26020 Linux: Error : The area of the resulting shape is"
puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to"
# planar face
plane pln_f1 0 -1450 -4.4408920985006262e-015 0 1 1.1102230246251565e-016

38
tests/bugs/heal/bug26642 Normal file
View File

@ -0,0 +1,38 @@
puts "========"
puts "OCC26642"
puts "========"
puts ""
############################################################################
# ShapeUpgrade_UnifySameDomain introduces extremely high vertex tolerances
############################################################################
restore [locate_data_file OCC26656_unify.input.brep] i
set bug_info [tolerance i]
set value_1 [lindex $bug_info 1]
set value_1 [string trim [string range $value_1 [expr {[string first "=" $value_1] + 1}] [expr {[string length $value_1] - 1}]]]
unifysamedom r i
set bug_info [tolerance i]
set value_2 [lindex $bug_info 1]
set value_2 [string trim [string range $value_2 [expr {[string first "=" $value_2] + 1}] [expr {[string length $value_2] - 1}]]]
set bug_info [tolerance r]
set value_3 [lindex $bug_info 1]
set value_3 [string trim [string range $value_3 [expr {[string first "=" $value_3] + 1}] [expr {[string length $value_3] - 1}]]]
if {$value_1 > $value_2} {
set diff_12 [expr {$value_1 - $value_2}]
} else {
set diff_12 [expr {$value_2 - $value_1}]
}
if {$value_1 > $value_3} {
set diff_13 [expr {$value_1 - $value_3}]
} else {
set diff_13 [expr {$value_3 - $value_1}]
}
if {$diff_12 > 1.e-06 || $diff_13 > 1.e-06} {
puts "ERROR: OCC26642 is reproduced. Command unifysamedom works wrongly."
}

View File

@ -2,8 +2,8 @@ puts "TODO OCC25109 ALL: Faulty shapes in variables"
restore [locate_data_file case_3_wire2.brep] s
set length 967.791
set nbsh_v 87
set nbsh_e 87
set length 956.2
set nbsh_v 80
set nbsh_e 80
set nbsh_w 1