0025138: SIGSEGV when sweeping along helix
[occt.git] / tests / bugs / moddata_2 / bug22758
1 puts "========================"
2 puts "OCC22758"
3 puts "========================"
4 puts ""
5 #######################################################################
6 # Problem in BRepExtrema_DistShapeShape
7 #
8 # This script tries to reproduce the bug in BRepExtrema_DistanceSS class reported
9 # by Rob Bacnrach on OCCT Forum: http://www.opencascade.org/org/forum/thread_23040
10 # (when first shape is edge and second is vertex, the points are returned
11 # for the solutions are swapped)
12 #
13 #######################################################################
14
15 set BugNumber OCC22758
16
17 bsplinecurve c1 2   2 0 3 1 3       0 2 0 1  1 1 0 1  2 2 0 1
18 mkedge e c1
19 vertex v 0 0 1
20
21 distmini r e v
22
23 set status 0
24 # result should contain one edge, starting on e and ending on v
25 #if { [llength $res] != 2 } {
26 #    puts "Error: result has structure different from expected: $res"
27 #    set status 1
28 #}
29
30 # get start and end vertices -- these should be solutions on e1 and e2
31 set sol [explode r v]
32
33 # check distances in correct order
34 distmini d1 [lindex $sol 0] e
35 distmini d2 [lindex $sol 1] v
36 set d1 [dval d1_val]
37 set d2 [dval d2_val]
38 puts "Distances from solutions to relevant objects: $d1, $d2"
39 if { $d1 > 1e-7 || $d2 > 1e-7 } {
40     puts "Error: distances are non-zero!"
41     set status 1
42 }
43
44 # check distances in swapped order
45 distmini d1 [lindex $sol 0] v
46 distmini d2 [lindex $sol 1] e
47 set d1 [dval d1_val]
48 set d2 [dval d2_val]
49 puts "Distances from solutions to swapped objects: $d1, $d2"
50 if { $d1 < 0.1 || $d2 < 0.1 } {
51     puts "Error: swapped distances are zero, i.e. solutions are swapped!"
52     set status 1
53 }
54
55 # Resume
56 puts ""
57 if { ${status} == 1 } {
58    puts "Faulty ${BugNumber}"
59 } else {
60    puts "OK ${BugNumber}"
61 }
62