1puts "========"
2puts "0027383: Modeling - improve handling of regularity on edges"
3puts "========"
4puts ""
5#################################################################
6# Check regularity setting on edges between parts of cylinder and spheres
7#################################################################
8
9pload MODELING
10pcylinder p1 2 10 180
11pcylinder p2 2 10 180
12tmirror p2 0 0 0 0 1 0
13nurbsconvert q p2
14
15psphere s1 2
16ttranslate s1 0 0 10
17psphere s2 2
18trotate s2 0 0 0 0 1 0 -90
19
20bclearobjects
21bcleartools
22baddobjects p1 p2
23baddtools s1 s2
24bfillds
25# fuse all solids
26bbop r 1
27
28encoderegularity r
29
30# check that minimal continuity is G1
31set rfaces [explode r F]
32set len [llength $rfaces]
33set nbshared 0
34set nbexpected 6
35for {set i 0} {$i < [expr $len-1]} {incr i} {
36  set f1 [lindex $rfaces $i]
37  set redges1 [explode $f1 E]
38
39  for {set j [expr $i+1]} {$j < $len} {incr j} {
40    set f2 [lindex $rfaces $j]
41    if {$f1 == $f2} continue
42
43    set redges2 [explode $f2 E]
44    foreach e1 $redges1 {
45      foreach e2 $redges2 {
46        if {[regexp "not" [compare $e1 $e2]]} continue
47
48        incr nbshared
49        if { [regexp "C0" [getedgeregularity $e1 $f1 $f2]] } {
50          puts "Error: Invalid regularity of the edge, expected at least G1"
51        }
52      }
53    }
54  }
55}
56
57if {${nbshared} == ${nbexpected} } {
58  puts "OK: Number of processed edges: ${nbshared}"
59} else {
60  puts "Error: incorrect number of processed edges (${nbshared} instead of ${nbexpected})"
61}
62
63# make image in HLR mode as illustration
64pload VISUALIZATION
65vdisplay r
66vfit
67vhlr on
68vdump ${imagedir}/${test_image}.png
69