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