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;
//-- 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();
//-- 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;
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
}
}
}
+
+//#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
--- /dev/null
+puts "========"
+puts "OCC26642"
+puts "========"
+puts ""
+############################################################################
+# ShapeUpgrade_UnifySameDomain introduces extremely high vertex tolerances
+############################################################################
+
+restore [locate_data_file bug26656_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."
+}