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();
return;
}
if(U1sup<(Domain.LastParameter()-Domain.LastTolerance())) {
- Res1sup=U1sup;
- PosSup=IntRes2d_Middle;
+ Res1sup=U1sup;
+ PosSup=IntRes2d_Middle;
}
else {
Res1sup=Domain.LastParameter();
/*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;
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
,const IntRes2d_Domain& Domain1
done=Standard_True;
+ if(nbsol==1 && CheckLLCoincidence(L1, L2, Domain1, Domain2, Tol))
+ nbsol = 2;
+
if(nbsol==1) {
//---------------------------------------------------
//-- d: distance du point I a partir de laquelle les
//------------------------------------------------------
- } //--------------- Fin du cas : 1 seul point --------------------
+ } //--------------- Fin du cas : 1 seul point --------------------
else {
//-- Intersection AND Domain1 --------> Segment ---------------------
//-- Attention Res1sup peut etre different de U2
//-- Mais on a Res1sup-Res1inf < Tol
- //gka #0022833
+ //gka #0022833
IntRes2d_TypeTrans aCurTrans = ( ProdVectTan >= TOLERANCE_ANGULAIRE ?
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 ) )
- Append(NewPoint1);
+ Append(NewPoint1);
}
}
--- /dev/null
+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"
+}