parameters.Append (firstu);
points .Append (P);
if (minNbPnts > 2) {
- Standard_Real Du = (lastu - firstu) / minNbPnts;
+ Standard_Real Du = (lastu - firstu) / (minNbPnts - 1);
Standard_Real U = firstu + Du;
- for (Standard_Integer i = 2; i <= minNbPnts; i++) {
+ for (Standard_Integer i = 2; i < minNbPnts; i++) {
D0 (C, U, P);
parameters.Append (U);
points .Append (P);
{
//Si c'est une droite on verifie en calculant minNbPoints :
Standard_Boolean IsLine = Standard_True;
+ Standard_Boolean IsSequential = Standard_True;
Standard_Integer NbPoints = (minNbPnts > 3) ? minNbPnts : 3;
switch (C.GetType()) {
case GeomAbs_BSplineCurve:
Intervs(i + 1) = lastu;
}
- Standard_Real delta = (Intervs(i+1) - Intervs(i))/NbPoints;
- for (j = 1; j <= NbPoints && IsLine; ++j)
+ Standard_Real delta = (Intervs(i+1) - Intervs(i))/(NbPoints-1);
+ for (j = 1; j < NbPoints && IsLine; ++j)
{
param = Intervs(i) + j*delta;
D0 (C, param, MiddlePoint);
{
const Standard_Real aAngle = V2.CrossMagnitude(V1)/(L1*L2);
IsLine = (aAngle < ATol);
+
+ // Check if points on line are subsequent
+ if(IsLine && IsSequential)
+ {
+ IsSequential = (L2 <= L1);
+ }
}
}
}
parameters.Clear();
points .Clear();
+ const Standard_Integer oldMinNbPoints = minNbPnts;
+ if(!IsSequential)
+ {
+ minNbPnts = NbPoints;
+ }
+
PerformLinear(C);
+
+ if(!IsSequential)
+ {
+ minNbPnts = oldMinNbPoints;
+ }
return;
}
else
--- /dev/null
+puts "========"
+puts "0030020: Incorrect bspline visualization"
+puts "========\n"
+
+set F [open pnts w]
+puts $F "3 3d"
+puts $F "0 0 0"
+puts $F "2 0 0"
+puts $F "1 0 0"
+close $F
+interpol c pnts
+file delete pnts
+
+set out [crvtpoints r c 0.1 1]
+if {[lindex $out 3] != 3} {
+ puts "Error: number of points is not equal to 3"
+}
+
+checklength r -l 3
mkcurve c a_8
set deflection 0.001
-set info [crvtpoints r c ${deflection} pi/6]
+set info [crvtpoints r c ${deflection} 30]
set str1 "Nb points +: +(\[-0-9.+eE\]+)\n"
set str2 "Max defl: +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"