0025952: Wrong intersection curve
[occt.git] / tests / lowalgos / intss / bug25782_1
1 puts "========"
2 puts "OCC25782"
3 puts "========"
4 puts ""
5 ######################################################
6 # The result of intersection between two cylinders is incorrect
7 # Algorithm must find one curves only
8 ######################################################
9
10 set GoodNbCurv 1
11
12 restore [locate_data_file bug25782_fz19.brep] b1
13 restore [locate_data_file bug25782_fz53.brep] b2
14
15 mksurface s1 b1
16 mksurface s2 b2
17
18 intersect res s1 s2
19
20 set che [whatis res]
21 set ind [string first "3d curve" $che]
22 if {${ind} >= 0} {
23   #Only variable "res" exists
24   
25   copy res res_1
26 }
27
28 set ic 1
29 set AllowRepeate 1
30 while { $AllowRepeate != 0 } {
31   set che [whatis res_$ic]
32   set ind [string first "3d curve" $che]
33   if {${ind} < 0} {
34     set AllowRepeate 0
35   } else {
36     xdistcs res_$ic s1 0 100 10 1e-7
37     xdistcs res_$ic s2 0 100 10 1e-7
38     
39     incr ic
40   }
41 }
42   
43 if {[expr {$ic - 1}] == $GoodNbCurv} {
44   puts "OK: Curve Number is good!"
45 } else {
46   puts "Error: Curves Number is bad!"
47 }
48
49 set log [bopcurves b1 b2]
50
51 regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
52 set MaxTol 1.e-7
53 if {${Toler} > ${MaxTol}} {
54    puts "Error: Tolerance is too big!"
55 }
56
57 if {$NbCurv != $GoodNbCurv} {
58   puts "Error: Curves Number is bad!"
59 }
60
61 for {set i 1} {$i <= ${NbCurv}} {incr i} {
62   bounds c_$i U1 U2
63   
64   if {[dval U2-U1] < 1.0e-9} {
65     puts "Error: Wrong curve's range!"
66   }
67
68   xdistcs c_$i s1 U1 U2 10 1e-7
69   xdistcs c_$i s2 U1 U2 10 1e-7
70 }