0025952: Wrong intersection curve
[occt.git] / tests / lowalgos / intss / bug29972_4
CommitLineData
98974dcc 1puts "========"
2puts "OCC29972: Intersection curve has a weird gap in the middle of it"
3puts "========"
4puts ""
5
6set GoodNbCurves 1
7
8foreach a [directory res*] {unset $a}
9
10restore [locate_data_file bug29972_s3.draw] s1
11plane s2 41.3489013503538 536.047793220744 -145.944893918698 0.999990480720734 0 0.00436330928474653 0.00436330928474653 0 -0.999990480720734
12
13intersect res s1 s2 1.0e-4
14
15if { [info exists res] } {
16 #Only variable "res" exists
17 renamevar res res_1
18}
19
20bclearobjects
21bcleartools
22
23set ic 1
24set AllowRepeat 1
25while { $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
66incr ic -1
67
68if { $ic != $GoodNbCurves } {
69 puts "Error: $GoodNbCurves are expected but $ic ones are found"
70}
71
72smallview
73don res_*
74
75fit
76clpoles s1
77don s1 s2
78disp res_*
79
80checkview -screenshot -2d -path ${imagedir}/${test_image}.png