1puts "TODO OCC27116 ALL: Error: Summary length  ="
2puts "TODO OCC27116 ALL: Error: 1 intersection curve\\(s\\) expected but"
3
4puts "================"
5puts "OCC25193"
6puts "================"
7puts ""
8#######################################################################
9# Bad Intersection curveobtained by Surface/Surface Intersection Algorithm.
10#######################################################################
11
12puts ""
13
14pload QAcommands
15
16set GoodNbCurv 1
17set GoodTol 3.6570868343352305e-005
18set NbControlPts 10
19
20restore [locate_data_file bug25193_s1t.draw] s1
21restore [locate_data_file bug25193_s4t.draw] s4
22
23#Ethalon of intersection curve
24bounds s1 us1 us2 vs1 vs2
25uiso cc s1 us1
26
27regexp {is ([-0-9.+eE]+)} [length cc 1.0e-4] full ExpLength
28puts "Expected length = $ExpLength"
29
30intersect res s1 s4 $GoodTol
31set che [whatis res]
32set ind [string first "3d curve" $che]
33
34set AllowRepeate 1
35set ic 1
36
37if {${ind} >= 0} {
38  #Only variable "res" exists
39  renamevar res res_1
40}
41
42set SumLength 0
43
44while { $AllowRepeate != 0 } {
45  set che [whatis res_$ic]
46  set ind [string first "3d curve" $che]
47  if {${ind} < 0} {
48    set AllowRepeate 0
49    break
50  }
51
52  for {set jc 1} {$jc < $ic} {incr jc} {
53    mkedge e1 res_$ic
54    mkedge e2 res_$jc
55    set coe [checkoverlapedges e1 e2]
56
57    puts "res_$ic <-> res_$jc: $coe"
58    if { [regexp "Edges are not overlapped" $coe] != 1 } {
59      puts "Error: Overlapped intersection curves"
60    }
61  }
62
63  regexp {is ([-0-9.+eE]+)} [length res_$ic 1.0e-4] full ll
64
65  set SumLength [ expr $SumLength+$ll ]
66
67  bounds res_$ic U1 U2
68
69  set step [ dval (U2-U1)/$NbControlPts ]
70
71  if { $step < 1.0e-9*$NbControlPts } {
72    puts "Error: Wrong curve's range!"
73  }
74
75  set DPPrev 0
76  for {set par [dval U1]} {$par <= [dval U2]} {set par [expr $par+$step]} {
77    cvalue res_$ic $par xx yy zz dx1 dy1 dz1
78    regexp " parameter 1 = +(\[-0-9*\.+eE\]+)" [proj cc xx yy zz] full cpar
79    cvalue cc $cpar xx yy zz dx2 dy2 dz2
80
81    set DP [dval dx1*dx2+dy1*dy2+dz1*dz2]
82
83    if {$DPPrev*$DP < 0.0} {
84      puts "Error: Curve res_$ic changes its direction"
85    }
86
87    set DPPrev $DP
88  }
89
90  incr ic
91}
92
93if {[expr {$ic - 1}] == $GoodNbCurv} {
94  puts "OK: Good number of intersection curve(s) obtained by Surface/Surface Intersection Algorithm"
95} else {
96  puts "Error: $GoodNbCurv intersection curve(s) expected but [expr {$ic - 1}] found"
97}
98
99checkreal "Summary length " ${SumLength} $ExpLength 0.0 1.0e-6
100
101smallview
102donly res_* s1 s4
103fit
104
105checkview -screenshot -2d -path ${imagedir}/${test_image}.png
106