0030869: Modeling Data - BRepAdaptor_CompCurve incorrectly evaluates the boundary...
[occt.git] / tests / bugs / modalg_7 / bug29824
1 puts "========"
2 puts "0029824: Intersection of cylinder and sphere is incorrect"
3 puts "========"
4 puts ""
5
6 restore [locate_data_file OCC20964_revsolid.brep] b1 
7 restore [locate_data_file OCC20964_sphere.brep] b2 
8 explode b1 f
9 explode b2 f
10 donly b1_7 b2_1
11
12 bop b1_7 b2_1
13 bopsection result
14
15 checknbshapes result -edge 3
16
17 foreach a [explode result e] {
18   mkcurve cc $a
19   bounds cc U1 U2
20   
21   if {[dval U2-U1] < 1.0e-9} {
22     puts "Error: Wrong curve's range!"
23   }
24   
25   set aStep [expr [dval U2-U1]/100.0 ]
26   set isFirst 1
27   set aCosPrev 1.0
28   dset dx1 0.0
29   dset dy1 0.0
30   dset dz1 0.0
31   for {set aU [dval U1]} {$aU <= [dval U2]} {set aU [expr $aU + $aStep]} {
32     cvalue cc $aU xx yy zz dx dy dz
33     
34     if {!$isFirst} {
35       set m1 [module dx1 dy1 dz1]
36       set m2 [module dx dy dz]
37       set aCos [dval dx1*dx+dy1*dy+dz1*dz]
38       set aCos [expr $aCos/($m1*$m2)]
39       
40       if {abs([expr $aCos - $aCosPrev]) > 0.05} {
41         puts "Error: It seems that the curve $a change it direction at the point $aU. Please recheck."
42         break
43       }
44       
45       set aCosPrev $aCos
46     }
47     
48     set isFirst 0
49     
50     dset dx1 dx
51     dset dy1 dy
52     dset dz1 dz
53   }
54 }