1puts "================"
2puts "OCC27937"
3puts "================"
4puts ""
5#######################################################################
6# 0027937: Intersector loops infinitely while proceeding two simple surfaces
7#######################################################################
8
9cpulimit 100
10
11# Attention!!!
12# The test on performance meter.
13# See issue #27937 for detail.
14set GoodNbCurv 4
15
16restore [locate_data_file bug27937_int1.draw] s1
17restore [locate_data_file bug27937_int2.draw] s2
18
19intersect result s1 s2
20
21set che [whatis result]
22set ind [string first "3d curve" $che]
23if {${ind} >= 0} {
24  #Only variable "result" exists
25  renamevar result result_1
26}
27
28set ic 1
29set AllowRepeate 1
30while { $AllowRepeate != 0 } {
31  set che [whatis result_$ic]
32  set ind [string first "3d curve" $che]
33  if {${ind} < 0} {
34    set AllowRepeate 0
35  } else {
36    display result_$ic
37
38    bounds result_$ic U1 U2
39
40    dump U1 U2
41
42    if {[dval U2-U1] < 1.0e-9} {
43      puts "Error: Wrong curve's range!"
44    }
45
46    xdistcs result_$ic s1 U1 U2 10 3.0e-5
47    xdistcs result_$ic s2 U1 U2 10 1.0e-5
48
49    for { set ip [expr $ic-1] } { $ip > 0 } { incr ip -1 } {
50      mkedge e1 result_$ic
51      mkedge e2 result_$ip
52
53      set coe [checkoverlapedges e1 e2 5.0e-5]
54
55      puts "result_$ic <-> result_$ip: $coe"
56      if { [regexp "Edges are not overlapped" $coe] != 1 } {
57        puts "Error: result_$ic and result_$ip are overlapped"
58      }
59    }
60
61    incr ic
62  }
63}
64
65if {[expr {$ic - 1}] == $GoodNbCurv} {
66  puts "OK: Number of curves is good!"
67} else {
68  puts "Error: $GoodNbCurv is expected but [expr {$ic - 1}] is found!"
69}
70
71smallview
72don result*
73fit
74clear
75don s1 s2 result*
76checkview -screenshot -2d -path ${imagedir}/${test_image}.png
77