0027537: GCPnts_TangentialDeflection produces incorrect number of sample points for...
[occt.git] / tests / bugs / modalg_6 / bug27537
diff --git a/tests/bugs/modalg_6/bug27537 b/tests/bugs/modalg_6/bug27537
new file mode 100644 (file)
index 0000000..a7b0a3c
--- /dev/null
@@ -0,0 +1,55 @@
+puts "============"
+puts "OCC27537"
+puts "============"
+puts ""
+######################################################
+# Incorrect number of sample points provided by GCPnts_TangentialDeflection
+######################################################
+
+restore [locate_data_file bug27537.brep] result
+incmesh result 0.2
+
+set bndbox [bounding result]
+set xMin [lindex $bndbox 0]
+set yMin [lindex $bndbox 1]
+set zMin [lindex $bndbox 2]
+set xMax [lindex $bndbox 3]
+set yMax [lindex $bndbox 4]
+set zMax [lindex $bndbox 5]
+
+mkcurve c result
+bounds c u1 u2
+set first [dval u1]
+set last  [dval u2]
+
+set x 0.
+set y 0.
+set z 0.
+set param 0.
+set isOk true
+
+set nbSamples 100
+set step [expr ($last - $first)/$nbSamples]
+for {set i 0} {$i <= $nbSamples} {incr i} {
+  if {$i < $nbSamples} {
+    set param [expr $first + $i * $step]
+  } else {
+    set param $last
+  }
+
+  cvalue c $param cx cy cz
+  set x [dval cx]
+  set y [dval cy]
+  set z [dval cz]
+  if {$x < $xMin || $x > $xMax || $y < $yMin || $y > $yMax || $z < $zMin || $z > $zMax} {
+    puts "ERROR: point ($x; $y; $z) is out of bounding box"
+    set isOk false
+  }
+}
+
+if {$isOk} {
+  puts "OK: all sample points inside bounding box"
+}
+
+top; fit
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png