0014531: Boolean Operation Algorithm fails
[occt.git] / tests / bugs / modalg_5 / bug25193
1 puts "TODO OCC27116 ALL: Error: Summary length  ="
2 puts "TODO OCC27116 ALL: Error: 1 intersection curve\\(s\\) expected but"
3
4 puts "================"
5 puts "OCC25193"
6 puts "================"
7 puts ""
8 #######################################################################
9 # Bad Intersection curveobtained by Surface/Surface Intersection Algorithm.
10 #######################################################################
11
12 puts ""
13
14 pload QAcommands
15
16 set GoodNbCurv 1
17 set GoodTol 3.6570868343352305e-005
18 set NbControlPts 10
19
20 restore [locate_data_file bug25193_s1t.draw] s1
21 restore [locate_data_file bug25193_s4t.draw] s4
22
23 #Ethalon of intersection curve
24 bounds s1 us1 us2 vs1 vs2
25 uiso cc s1 us1
26
27 regexp {is ([-0-9.+eE]+)} [length cc 1.0e-4] full ExpLength
28 puts "Expected length = $ExpLength"
29
30 intersect res s1 s4 $GoodTol
31 set che [whatis res]
32 set ind [string first "3d curve" $che]
33
34 set AllowRepeate 1
35 set ic 1
36
37 if {${ind} >= 0} {
38   #Only variable "res" exists
39   renamevar res res_1
40 }
41
42 set SumLength 0
43
44 while { $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 is not overlaped" $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   
93 if {[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
99 checkreal "Summary length " ${SumLength} $ExpLength 0.0 1.0e-6
100
101 smallview
102 donly res_* s1 s4
103 fit
104
105 checkview -screenshot -2d -path ${imagedir}/${test_image}.png