puts "========"
puts "0031307: Modeling Algorithms - Offset algorithm produces incorrect result in mode Complete join type Intersection"
puts "========"
puts ""

restore [locate_data_file bug31307_input_trim.brep] s
offsetparameter 1e-7 c i r
offsetload s 0
foreach f [explode s f] {
  mksurface surf $f
  set found [regexp {Axis   :([-0-9.+eE]*), ([-0-9.+eE]*), ([-0-9.+eE]*)} [dump surf] full x y z]
  if {$found && abs($z - 1) < 1.e-7} {
    offsetonface $f 0
  } else {
    if {$found && abs($z) < 1.e-7} {
      offsetonface $f 10
    } else {
      offsetonface $f 9.961946980917444
    }
  }
}
offsetperform result

checkprops result -s 245702 -v 2.91993e+06

unifysamedom result_unif result
checknbshapes result_unif -vertex 22 -edge 34 -wire 14 -face 14 -shell 1 -solid 1

checkview -display result_unif -2d -path ${imagedir}/${test_image}.png
