0029972: Intersection curve has a weird gap in the middle of it
[occt.git] / tests / bugs / modalg_7 / bug29972_4
1 puts "========"
2 puts "OCC29972: Intersection curve has a weird gap in the middle of it"
3 puts "========"
4 puts ""
5
6 set GoodNbCurves 1
7
8 foreach a [directory res*] {unset $a}
9
10 restore [locate_data_file bug29972_s3.draw] s1
11 plane s2 41.3489013503538 536.047793220744 -145.944893918698 0.999990480720734 0 0.00436330928474653 0.00436330928474653 0 -0.999990480720734
12
13 intersect res s1 s2 1.0e-4
14
15 if { [info exists res] } {
16   #Only variable "res" exists
17   renamevar res res_1
18 }
19
20 bclearobjects
21 bcleartools
22
23 set ic 1
24 set AllowRepeat 1
25 while { $AllowRepeat != 0 } {
26   if { ![info exists res_$ic] } {
27     set AllowRepeat 0
28   } else {
29     bounds res_$ic U1 U2
30     
31     if {[dval U2-U1] < 1.0e-9} {
32       puts "Error: Wrong curve's range!"
33     }
34     
35     xdistcs res_$ic s1 U1 U2 100 0.01
36     xdistcs res_$ic s2 U1 U2 100 0.01    
37     
38     #check whether the curve has a loop
39     set delta [dval (U2-U1)/1000.0]
40     cvalue res_$ic [dval U1] xp yp zp dx1 dy1 dz1
41     for {set p [dval U1]} {$p <= [dval U2]} {set p [expr $p + $delta]} {
42       cvalue res_$ic $p xp yp zp dx2 dy2 dz2
43       
44       #Check if the angle between the vectors {dx1 dy1 dz1} and {dx2 dy2 dz2} is less than 75deg.
45       set nv1 [ dval dx1*dx1+dy1*dy1+dz1*dz1 ] 
46       set nv2 [ dval dx2*dx2+dy2*dy2+dz2*dz2 ] 
47       
48       set nv1 [ expr sqrt($nv1) ]
49       set nv2 [ expr sqrt($nv2) ]
50       
51       set dp [ dval dx1*dx2+dy2*dy2+dz1*dz2 ] 
52       
53       if {$dp < [ expr 0.25881904510252076234889883762405 * $nv1 * $nv2 ] } {
54         puts "Error: The curve res_$ic is possible to have a bend at parameter $p. Please check carefully"
55       }      
56       
57       dset dx1 dx2
58       dset dy1 dy2
59       dset dz1 dz2
60     }
61     
62     incr ic
63   }
64 }
65
66 incr ic -1
67
68 if { $ic != $GoodNbCurves } {
69   puts "Error: $GoodNbCurves are expected but $ic ones are found"
70 }
71
72 smallview
73 don res_*
74
75 fit
76 clpoles s1
77 don s1 s2
78 disp res_*
79
80 checkview -screenshot -2d -path ${imagedir}/${test_image}.png