Use correct ranges of circles when processing the concentric case. Repeat the range comparison 3 times shifting each time for a half-period to process the extrema between boundary points of arcs.
if ((aRange.Delta() > Precision::Angular()) &&
((aPar2 - aPar1) < Precision::Angular()))
{
- aPar1 -= aPeriod;
+ aPar2 += aPeriod;
}
}
Standard_Real aMinSquareDist = RealLast();
- aProjRng1.Add(aPar1 - M_PI);
- aProjRng1.Add(aPar2 - M_PI);
- for (Standard_Integer i = 0; i < 2; i++)
+ aProjRng1.Add(aPar1 - aPeriod);
+ aProjRng1.Add(aPar2 - aPeriod);
+ for (Standard_Integer i = 0; i < 3; i++)
{
- // Repeat computation twice
+ // Repeat computation three times, shifting the range to PI on each step,
+ // to be able to find if the concentric arcs ranges are intersected in just one parameter
+ // (lower or upper boundary).
Bnd_Range aRng = aProjRng1;
aRng.Common(aRange);
--- /dev/null
+puts "========"
+puts "0031407: Extrema does not process parallel circles correctly"
+puts "========"
+puts ""
+
+circle c1 0 0 0 0 0 1 5
+circle c2 0 0 0 0 0 1 10
+
+if { [regexp "Infinite number of extremas" [extrema c1 c2]] == 1} {
+ puts "OK : Circles are treated as concentric"
+} else {
+ puts "Error : Extrema does not find the circles are parallel"
+}
--- /dev/null
+puts "========"
+puts "0031407: Extrema does not process parallel circles correctly"
+puts "========"
+puts ""
+
+circle c1 0 0 0 0 0 -1 5
+circle c2 0 0 0 0 0 1 10
+
+if { [regexp "Infinite number of extremas" [extrema c1 c2]] == 1} {
+ puts "OK : Circles are treated as concentric"
+} else {
+ puts "Error : Extrema does not find the circles are parallel"
+}
--- /dev/null
+puts "========"
+puts "0031407: Extrema does not process parallel circles correctly"
+puts "========"
+puts ""
+
+circle c1 0 0 0 0 0 1 5
+circle c2 0 0 0 0 0 1 10
+
+trim cc1 c1 0 2
+trim cc2 c2 2 4
+
+set res_extrema [extrema cc1 cc2]
+
+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"
+}