0029351: Boolean Operations create invalid pcurves
[occt.git] / tests / bugs / moddata_2 / bug22758
CommitLineData
7faaccfd 1puts "========================"
2puts "OCC22758"
3puts "========================"
4puts ""
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
15set BugNumber OCC22758
16
17bsplinecurve c1 2 2 0 3 1 3 0 2 0 1 1 1 0 1 2 2 0 1
18mkedge e c1
19vertex v 0 0 1
20
9753e6de 21distmini r e v
7faaccfd 22
23set status 0
24# result should contain one edge, starting on e and ending on v
9753e6de 25#if { [llength $res] != 2 } {
26# puts "Error: result has structure different from expected: $res"
27# set status 1
28#}
7faaccfd 29
30# get start and end vertices -- these should be solutions on e1 and e2
9753e6de 31set sol [explode r v]
7faaccfd 32
33# check distances in correct order
9753e6de 34distmini d1 [lindex $sol 0] e
35distmini d2 [lindex $sol 1] v
36set d1 [dval d1_val]
37set d2 [dval d2_val]
38puts "Distances from solutions to relevant objects: $d1, $d2"
7faaccfd 39if { $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
9753e6de 45distmini d1 [lindex $sol 0] v
46distmini d2 [lindex $sol 1] e
47set d1 [dval d1_val]
48set d2 [dval d2_val]
49puts "Distances from solutions to swapped objects: $d1, $d2"
7faaccfd 50if { $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
56puts ""
57if { ${status} == 1 } {
58 puts "Faulty ${BugNumber}"
59} else {
60 puts "OK ${BugNumber}"
61}
62