4b114473 |
1 | puts "========" |
2 | puts "OCC29734" |
3 | puts "========" |
4 | puts "" |
5 | ####################### |
6 | # Compute global properties of tessellated shape |
7 | ####################### |
8 | proc compmass { mass props1 props2 } { |
9 | regexp {Mass +: +([-0-9.+eE]+)} ${props1} full m1 |
10 | regexp {Mass +: +([-0-9.+eE]+)} ${props2} full m2 |
11 | if { abs ($m1 - $m2) > 1.e-7 } { |
12 | puts "Error : The $mass by geometry is $m1, by triangulation is $m2" |
13 | } else { |
14 | puts "The $mass are equal $m1" |
15 | } |
16 | } |
17 | # |
18 | proc compmoms { props1 props2 } { |
19 | set moments {"IX" "IY" "IZ"} |
20 | foreach moment $moments { |
21 | set exp_string "${moment} = +(\[-0-9.+eE\]+)" |
22 | regexp "${exp_string}" ${props1} full m1 |
23 | regexp "${exp_string}" ${props2} full m2 |
24 | if { abs ($m1 - $m2) > 1.e-7 } { |
25 | puts "Error : The ${moment} by geometry is $m1, by triangulation is $m2" |
26 | } else { |
27 | puts "The moments ${moment} are equal $m1" |
28 | } |
29 | } |
30 | } |
31 | # |
32 | proc compprops { shape } { |
33 | upvar ${shape} ${shape} |
34 | set commands {"lprops" "sprops" "vprops"} |
35 | foreach command ${commands} { |
36 | switch $command { |
37 | "lprops" { set mass "length" } |
38 | "sprops" { set mass "area" } |
39 | "vprops" { set mass "volume" } |
40 | } |
41 | puts "" |
42 | set props1 [eval $command ${shape} -full] |
43 | set props2 [eval $command ${shape} -full -tri] |
44 | compmass $mass $props1 $props2 |
45 | compmoms $props1 $props2 |
46 | } |
47 | } |
48 | |
49 | #For shapes consisted from planar polygonal faces |
50 | #results of computation of global properties using exact geometry |
51 | #and using triangulations must be the same |
52 | #It is checked by this test |
53 | box b1 1 2 3 |
54 | box b2 3 2 1 |
55 | ttranslate b2 .5 .5 .5 |
56 | trotate b2 0 0 0 1 1 1 30 |
57 | bfuse ff b1 b2 |
58 | incmesh ff .01 |
59 | set tri_info [eval trinfo ff] |
60 | puts $tri_info |
61 | |
62 | # check of equality calculations by triangulation and exact geometry |
63 | #set shape "ff" |
64 | compprops ff |