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"
14 puts "The $mass are equal $m1"
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"
27 puts "The moments ${moment} are equal $m1"
32 proc compprops { shape } {
33 upvar ${shape} ${shape}
34 set commands {"lprops" "sprops" "vprops"}
35 foreach command ${commands} {
37 "lprops" { set mass "length" }
38 "sprops" { set mass "area" }
39 "vprops" { set mass "volume" }
42 set props1 [eval $command ${shape} -full]
43 set props2 [eval $command ${shape} -full -tri]
44 compmass $mass $props1 $props2
45 compmoms $props1 $props2
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
55 ttranslate b2 .5 .5 .5
56 trotate b2 0 0 0 1 1 1 30
59 set tri_info [eval trinfo ff]
62 # check of equality calculations by triangulation and exact geometry