44cf55e6 |
1 | # test for #22778: compare number of triangles in triangulation |
2 | # produced on surface converted to nurbs, against number of triangles on |
3 | # original analytic (spherical) surface |
4 | |
5 | puts "TODO #22778 All: too many triangles" |
6 | |
7 | # original face on spherical surface |
8 | restore [locate_data_file bug22778_square.brep] s |
9 | checkshape s |
10 | incmesh s 0.001 |
11 | set trinfo_s [trinfo s] |
12 | regexp {([0-9]+) triangles} $trinfo_s str nbtri_s |
13 | regexp {deflection ([0-9.+e-]+)} $trinfo_s str defl_s |
14 | |
15 | # face converted to NURBS |
16 | nurbsconvert r s |
17 | checkshape r |
18 | incmesh r 0.001 |
19 | set trinfo_r [trinfo r] |
20 | regexp {([0-9]+) triangles} $trinfo_r str nbtri_r |
21 | regexp {deflection ([0-9.+e-]+)} $trinfo_r str defl_r |
22 | |
23 | # check deflections |
24 | if { $defl_s > 0.001 } { |
25 | puts "Error: too big deflection on original face ($defl_s > 0.001)" |
26 | } |
27 | if { $defl_r > 0.001 } { |
28 | puts "Error: too big deflection on NURBS face ($defl_r > 0.001)" |
29 | } |
30 | |
31 | # compare number of triangles, allow twice more |
32 | if { $nbtri_r > [expr 2. * $nbtri_s] } { |
33 | puts "Error: too many triangles ($nbtri_r, while ~ $nbtri_s would be sufficient)" |
34 | } |
35 | |
36 | # extra check: deflection on rough mesh on NURBS |
37 | tclean r |
38 | incmesh r 0.1 |
39 | set trinfo_r_01 [trinfo r] |
40 | regexp {deflection ([0-9.+e-]+)} $trinfo_r_01 str defl_r_01 |
41 | if { $defl_r_01 > 0.1 } { |
42 | puts "Error: too big deflection on NURBS face ($defl_r > 0.1)" |
43 | } |