mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0026099: Wrong result done by 2d intersection algorithm
Detection of intersection for almost parallel lines has been improved. Test-case for issue #26099 and adjusting of test-case boolean volumemaker B6
This commit is contained in:
parent
a5565a3cb5
commit
ba5ab97f5d
@ -552,12 +552,12 @@ void DomainIntersection(const IntRes2d_Domain& Domain
|
|||||||
|
|
||||||
if(Domain.HasFirstPoint()) {
|
if(Domain.HasFirstPoint()) {
|
||||||
if(U1sup < (Domain.FirstParameter()-Domain.FirstTolerance())) {
|
if(U1sup < (Domain.FirstParameter()-Domain.FirstTolerance())) {
|
||||||
Res1inf=1; Res1sup=-1;
|
Res1inf=1; Res1sup=-1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(U1inf>(Domain.FirstParameter()+Domain.FirstTolerance())) {
|
if(U1inf>(Domain.FirstParameter()+Domain.FirstTolerance())) {
|
||||||
Res1inf=U1inf;
|
Res1inf=U1inf;
|
||||||
PosInf=IntRes2d_Middle;
|
PosInf=IntRes2d_Middle;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Res1inf=Domain.FirstParameter();
|
Res1inf=Domain.FirstParameter();
|
||||||
@ -575,8 +575,8 @@ void DomainIntersection(const IntRes2d_Domain& Domain
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(U1sup<(Domain.LastParameter()-Domain.LastTolerance())) {
|
if(U1sup<(Domain.LastParameter()-Domain.LastTolerance())) {
|
||||||
Res1sup=U1sup;
|
Res1sup=U1sup;
|
||||||
PosSup=IntRes2d_Middle;
|
PosSup=IntRes2d_Middle;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Res1sup=Domain.LastParameter();
|
Res1sup=Domain.LastParameter();
|
||||||
@ -602,9 +602,9 @@ void DomainIntersection(const IntRes2d_Domain& Domain
|
|||||||
/*if(PosInf==IntRes2d_Head) {
|
/*if(PosInf==IntRes2d_Head) {
|
||||||
if(Res1sup <= (Res1inf+Domain.FirstTolerance())) {
|
if(Res1sup <= (Res1inf+Domain.FirstTolerance())) {
|
||||||
Res1sup=Res1inf;
|
Res1sup=Res1inf;
|
||||||
PosSup=IntRes2d_Head;
|
PosSup=IntRes2d_Head;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(PosSup==IntRes2d_End) {
|
if(PosSup==IntRes2d_End) {
|
||||||
if(Res1inf >= (Res1sup-Domain.LastTolerance())) {
|
if(Res1inf >= (Res1sup-Domain.LastTolerance())) {
|
||||||
Res1inf=Res1sup;
|
Res1inf=Res1sup;
|
||||||
@ -1193,6 +1193,30 @@ static Standard_Boolean computeIntPoint(const IntRes2d_Domain& theCurDomain,
|
|||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : CheckLLCoincidence
|
||||||
|
//purpose : Returns true if input are trimmed curves and they coincide
|
||||||
|
// within tolerance
|
||||||
|
//=======================================================================
|
||||||
|
static Standard_Boolean CheckLLCoincidence(const gp_Lin2d& L1,
|
||||||
|
const gp_Lin2d& L2,
|
||||||
|
const IntRes2d_Domain& Domain1,
|
||||||
|
const IntRes2d_Domain& Domain2,
|
||||||
|
const Standard_Real theTol)
|
||||||
|
{
|
||||||
|
Standard_Boolean isFirst1 = (Domain1.HasFirstPoint() &&
|
||||||
|
L2.Distance(Domain1.FirstPoint()) < theTol);
|
||||||
|
Standard_Boolean isLast1 = (Domain1.HasLastPoint() &&
|
||||||
|
L2.Distance(Domain1.LastPoint()) < theTol);
|
||||||
|
if (isFirst1 && isLast1)
|
||||||
|
return Standard_True;
|
||||||
|
Standard_Boolean isFirst2 = (Domain2.HasFirstPoint() &&
|
||||||
|
L1.Distance(Domain2.FirstPoint()) < theTol);
|
||||||
|
Standard_Boolean isLast2 = (Domain2.HasLastPoint() &&
|
||||||
|
L1.Distance(Domain2.LastPoint()) < theTol);
|
||||||
|
return isFirst2 && isLast2;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void IntCurve_IntConicConic::Perform(const gp_Lin2d& L1
|
void IntCurve_IntConicConic::Perform(const gp_Lin2d& L1
|
||||||
,const IntRes2d_Domain& Domain1
|
,const IntRes2d_Domain& Domain1
|
||||||
@ -1223,6 +1247,9 @@ void IntCurve_IntConicConic::Perform(const gp_Lin2d& L1
|
|||||||
|
|
||||||
done=Standard_True;
|
done=Standard_True;
|
||||||
|
|
||||||
|
if(nbsol==1 && CheckLLCoincidence(L1, L2, Domain1, Domain2, Tol))
|
||||||
|
nbsol = 2;
|
||||||
|
|
||||||
if(nbsol==1) {
|
if(nbsol==1) {
|
||||||
//---------------------------------------------------
|
//---------------------------------------------------
|
||||||
//-- d: distance du point I a partir de laquelle les
|
//-- d: distance du point I a partir de laquelle les
|
||||||
@ -1321,7 +1348,7 @@ void IntCurve_IntConicConic::Perform(const gp_Lin2d& L1
|
|||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
} //--------------- Fin du cas : 1 seul point --------------------
|
} //--------------- Fin du cas : 1 seul point --------------------
|
||||||
|
|
||||||
else {
|
else {
|
||||||
//-- Intersection AND Domain1 --------> Segment ---------------------
|
//-- Intersection AND Domain1 --------> Segment ---------------------
|
||||||
@ -1622,13 +1649,13 @@ void IntCurve_IntConicConic::Perform(const gp_Lin2d& L1
|
|||||||
//-- Attention Res1sup peut etre different de U2
|
//-- Attention Res1sup peut etre different de U2
|
||||||
//-- Mais on a Res1sup-Res1inf < Tol
|
//-- Mais on a Res1sup-Res1inf < Tol
|
||||||
|
|
||||||
//gka #0022833
|
//gka #0022833
|
||||||
IntRes2d_TypeTrans aCurTrans = ( ProdVectTan >= TOLERANCE_ANGULAIRE ?
|
IntRes2d_TypeTrans aCurTrans = ( ProdVectTan >= TOLERANCE_ANGULAIRE ?
|
||||||
IntRes2d_In : ( ProdVectTan <= -TOLERANCE_ANGULAIRE ? IntRes2d_Out : IntRes2d_Undecided ) );
|
IntRes2d_In : ( ProdVectTan <= -TOLERANCE_ANGULAIRE ? IntRes2d_Out : IntRes2d_Undecided ) );
|
||||||
|
|
||||||
IntRes2d_IntersectionPoint NewPoint1;
|
IntRes2d_IntersectionPoint NewPoint1;
|
||||||
if( computeIntPoint(Domain2, Domain1, L2, L1, aCosT1T2, U2, U1, Res2inf, Res2sup, 2, aCurTrans, NewPoint1 ) )
|
if( computeIntPoint(Domain2, Domain1, L2, L1, aCosT1T2, U2, U1, Res2inf, Res2sup, 2, aCurTrans, NewPoint1 ) )
|
||||||
Append(NewPoint1);
|
Append(NewPoint1);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
|
puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
|
||||||
puts "TODO OCC26020 ALL: Error: bopcheck failed"
|
puts "TODO OCC26020 ALL: Error: bopcheck failed"
|
||||||
puts "TODO OCC26020 Linux: Error : The area of the resulting shape is"
|
puts "TODO OCC26020 ALL: Error : The area of the resulting shape is"
|
||||||
|
|
||||||
# planar face
|
# planar face
|
||||||
plane pln_f1 35.877464033656999 5.9462928582193458e-016 -25.973690230789806 -0.64944804833018333 -3.0834627769631957e-016 -0.76040596560003137
|
plane pln_f1 35.877464033656999 5.9462928582193458e-016 -25.973690230789806 -0.64944804833018333 -3.0834627769631957e-016 -0.76040596560003137
|
||||||
|
23
tests/bugs/modalg_6/bug26099
Normal file
23
tests/bugs/modalg_6/bug26099
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC26099"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
##################################################
|
||||||
|
# Wrong result done by 2d intersection algorithm
|
||||||
|
##################################################
|
||||||
|
|
||||||
|
restore [locate_data_file OCC26099-f.brep] f
|
||||||
|
explode f e
|
||||||
|
pcurve c4 f_4 f
|
||||||
|
pcurve c5 f_5 f
|
||||||
|
set bug_info [2dintersect c4 c5]
|
||||||
|
|
||||||
|
if {[regexp {fist: ([\-0-9.]*) .*second: ([\-0-9.]*)} $bug_info dummy par1 par2] == 0} {
|
||||||
|
puts "ERROR: OCC26099 is reproduced. No intersection."
|
||||||
|
}
|
||||||
|
|
||||||
|
set refpar1 0.98989794855663704
|
||||||
|
set refpar2 0
|
||||||
|
if {[expr abs($par1-$refpar1)] > 0.0001 || [expr abs($par2-$refpar2)] > 0.0001} {
|
||||||
|
puts "ERROR: OCC26099 is reproduced. Parameters are $par1 and $par2, expected $refpar1 and $refpar2"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user