dfR, curvatureDeflection, angularDeflection, myMinLen);
const Standard_Real aDiff = lastu - firstu;
- Standard_Integer NbPoints = (Standard_Integer)(aDiff / Du);
+ // Round up number of points to satisfy curvatureDeflection more precisely
+ Standard_Integer NbPoints = (Standard_Integer)Ceiling(aDiff / Du);
NbPoints = Max(NbPoints, minNbPnts - 1);
Du = aDiff / NbPoints;
--- /dev/null
+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