mypoints.Append(aP2);
mySqDist.Append(theSqDist);
}
- }
+ else
+ {
+ //Case like this:
+
+ // ************** aLin1
+ // o
+ // o
+ // *********** aLin2
+ //
+ //Take minimal trimmed distance
+ Standard_Real aDmin, aDists[4] = {mydist11, mydist12, mydist21, mydist22};
+ Extrema_POnCurv aP1, aP2;
+ aDmin = aDists[0];
+ Standard_Integer i, imin = 0;
+ for (i = 1; i < 4; ++i)
+ {
+ if (aDmin > aDists[i])
+ {
+ aDmin = aDists[i];
+ imin = i;
+ }
+ }
+ if (imin == 0)
+ {
+ aP1.SetValues(myInf[0], P1f);
+ aP2.SetValues(myInf[1], P2f);
+ }
+ else if (imin == 1)
+ {
+ aP1.SetValues(myInf[0], P1f);
+ aP2.SetValues(mySup[1], P2l);
+ }
+ else if (imin == 2)
+ {
+ aP1.SetValues(mySup[0], P1l);
+ aP2.SetValues(myInf[1], P2f);
+ }
+ else
+ {
+ aP1.SetValues(mySup[0], P1l);
+ aP2.SetValues(mySup[1], P2l);
+ }
+ ClearSolutions();
+ mypoints.Append(aP1);
+ mypoints.Append(aP2);
+ mySqDist.Append(aDmin);
+ }
+ }
}
else
{
aMinSqD = Min(aMinSqD, ExtPCir.SquareDistance(anExtID));
}
- if (aMinSqD <= aMinSquareDist)
+ if (aMinSqD <= aMinSquareDist + 10.* Epsilon(1. + aMinSqD))
{
ClearSolutions();
mySqDist.Append(aMinSqD);
}
}
}
+ else
+ {
+ //Case like this:
+ // ************** Cir1
+ // o
+ // o
+ // *********** Cir2
+ //
+ //Take minimal trimmed distance
+ myIsPar = Standard_False;
+ Standard_Real aDmin, aDists[4] = { mydist11, mydist12, mydist21, mydist22 };
+ Extrema_POnCurv aP1, aP2;
+ aDmin = aDists[0];
+ Standard_Integer k, imin = 0;
+ for (k = 1; k < 4; ++k)
+ {
+ if (aDmin > aDists[k])
+ {
+ aDmin = aDists[k];
+ imin = k;
+ }
+ }
+ if (aDmin <= aMinSquareDist + 10.* Epsilon(1. + aDmin))
+ {
+ if (imin == 0)
+ {
+ aP1.SetValues(myInf[0], P1f);
+ aP2.SetValues(myInf[1], P2f);
+ }
+ else if (imin == 1)
+ {
+ aP1.SetValues(myInf[0], P1f);
+ aP2.SetValues(mySup[1], P2l);
+ }
+ else if (imin == 2)
+ {
+ aP1.SetValues(mySup[0], P1l);
+ aP2.SetValues(myInf[1], P2f);
+ }
+ else
+ {
+ aP1.SetValues(mySup[0], P1l);
+ aP2.SetValues(mySup[1], P2l);
+ }
+ ClearSolutions();
+ mypoints.Append(aP1);
+ mypoints.Append(aP2);
+ mySqDist.Append(aDmin);
+ aMinSquareDist = Min(aMinSquareDist, aDmin);
+ }
+ }
aProjRng1.Shift(M_PI);
}
}
--- /dev/null
+puts "========"
+puts "0026269: Modeling Data - Analytical extrema does not take into account trimmed input data"
+puts "========"
+puts ""
+
+#case 1
+line l1 0 0 0 1 0 0
+line l2 2 2 0 1 0 0
+trim l1 l1 0 1
+trim l2 l2 0 1
+
+set res_extrema [extrema l1 l2]
+
+if { [regexp "Infinite number of extremas" $res_extrema] == 0} {
+ if {[llength $res_extrema] != 1} {
+ puts "Error : expected 1 extrema, but found [llength $res_extrema]"
+ }
+} else {
+ puts "Error : Infinite number of extremas is found"
+}
+
+smallview +X+Y
+fit
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
--- /dev/null
+puts "========"
+puts "0026269: Modeling Data - Analytical extrema does not take into account trimmed input data"
+puts "========"
+puts ""
+
+#case 2
+circle c1 0 0 0 10
+circle c2 0 0 0 5
+trim c1 c1 0 1
+trim c2 c2 3 4
+
+set res_extrema [extrema c1 c2]
+
+if { [regexp "Infinite number of extremas" $res_extrema] == 0} {
+ if {[llength $res_extrema] != 1} {
+ puts "Error : expected 1 extrema, but found [llength $res_extrema]"
+ }
+} else {
+ puts "Error : Infinite number of extremas is found"
+}
+
+smallview +X+Y
+fit
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
trim c1 c1 0 3
trim c2 c2 4 6
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
trim c1 c1 0 3
trim c2 c2 -3.2 -1.2
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
\ No newline at end of file
# However, they are bounded (trimmed) curves
# and are shifted relatively to each other.
-set ExpDist 150.0
-
circle c1 0 0 0 0 0 1 100
circle c2 0 0 0 0 0 1 50
trim c1 c1 0 3
trim c2 c2 -3.1 -1.1
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
+
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
# However, they are bounded (trimmed) curves
# and are shifted relatively to each other.
-set ExpDist 150.0
circle c1 0 0 0 0 0 1 100
circle c2 0 0 0 0 0 1 50
trim c1 c1 0 3
trim c2 c2 -9.5 -7.5
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
trim c1 c1 0 3
trim c2 c2 -8.3 -6.3
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
# However, they are bounded (trimmed) curves
# and are shifted relatively to each other.
-set ExpDist 150.0
circle c1 0 0 0 0 0 1 100
circle c2 0 0 0 0 0 1 50
trim c1 c1 0 3
trim c2 c2 3.1 5.1
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
trim c1 c1 0 1
trim c2 c2 0 1
-if { ![regexp {No solutions!} [extrema c1 c2] ] } {
+extrema c1 c2
+
+if { ![isdraw ext_1 ] } {
puts "Error in Extrema-algorithm"
} else {
puts "Extrema-algorithm works properly"
}
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
trim c1 c1 0 pi
trim c2 c2 -9.4 -7.4
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
trim c1 c1 3 6.5
trim c2 c2 4 6
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c1 c2] full aDist1
-checkreal Distance $aDist1 $ExpDist 1.0e-7 0.0
+extrema c1 c2
+
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
+
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
+ puts "Error in Extrema-algorithm"
+} else {
+ puts "Extrema-algorithm works properly"
+}
-regexp {Infinite number of extremas, distance = +([-0-9.+eE]+)} [extrema c2 c1] full aDist2
-checkreal Distance $aDist2 $ExpDist 1.0e-7 0.0
trim c1 c1 -1.0e100 5
trim c2 c2 10 20
-if { ![regexp {No solutions!} [extrema c1 c2] ] } {
+extrema c1 c2
+
+if { ![isdraw ext_1 ] } {
puts "Error in Extrema-algorithm"
} else {
puts "Extrema-algorithm works properly"
}
-if { ![regexp {No solutions!} [extrema c2 c1] ] } {
+renamevar ext_1 e1
+extrema c2 c1
+
+if { ![isdraw ext_1 ] } {
puts "Error in Extrema-algorithm"
} else {
puts "Extrema-algorithm works properly"
-}
+}
\ No newline at end of file