puts "==========================================================="
puts "0033828: Modeling Data - GCPnts_QuasiUniformDeflection"
puts "returns very different results under small change in deflection"
puts "==========================================================="

proc check_crvpoints {cc deflection nb_expected} {
    upvar ${cc} ${cc}

    set str1 "Nb points +: +(\[-0-9.+eE\]+)\n"
    set str2 "Max defl: +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"

    set info [crvpoints r ${cc} ${deflection}]
    regexp "${str1}${str2}" ${info} full Nb dmax ufmax ulmax i

    if { ${Nb} != ${nb_expected} } {
        puts "Error : bad value of Nb points = ${Nb}, expected ${nb_expected}"
    }

    if { ${dmax} > ${deflection} } {
        puts "Error : bad value of maximum deflection = ${dmax}, expected < ${deflection}"
    }
}

bsplinecurve cu 3 7  0 4  0.17 2  0.33 2  0.5 2  0.67 2  0.83 2  1 4   0.163 0.233 0 1  0.158 0.204 0 1  0.139 0.180 0 1  0.086 0.159 0 1  0.055 0.163 0 1  0.009 0.196 0 1  -0.004 0.225 0 1  0.002 0.281 0 1  0.019 0.307 0 1  0.070 0.332 0 1  0.101 0.331 0 1  0.149 0.301 0 1  0.164 0.274 0 1  0.163 0.246 0 1

check_crvpoints cu .5     2
check_crvpoints cu .1     3
check_crvpoints cu .05    5
check_crvpoints cu .025   5
check_crvpoints cu .007   9
check_crvpoints cu .005  17
check_crvpoints cu .0005 33
check_crvpoints cu .0003 65
check_crvpoints cu .0002 65
check_crvpoints cu .0001 73
