From 6b41f0f335692887425b9940bb3c88da1ab9232a Mon Sep 17 00:00:00 2001 From: kgv Date: Wed, 5 Jun 2019 09:34:21 +0300 Subject: [PATCH] 0030754: Coding - the array of weights should begin with Lower, not the constant value 1 within Geom_BSplineCurve.cxx --- src/Geom/Geom_BSplineCurve.cxx | 21 +++++++++------------ src/Geom2d/Geom2d_BSplineCurve.cxx | 21 +++++++++------------ 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/src/Geom/Geom_BSplineCurve.cxx b/src/Geom/Geom_BSplineCurve.cxx index 9fc6eef813..87e6c9fe5f 100644 --- a/src/Geom/Geom_BSplineCurve.cxx +++ b/src/Geom/Geom_BSplineCurve.cxx @@ -81,20 +81,17 @@ static void CheckCurveData throw Standard_ConstructionError("BSpline curve: # Poles and degree mismatch"); } -//======================================================================= -//function : Rational -//purpose : check rationality of an array of weights -//======================================================================= - -static Standard_Boolean Rational(const TColStd_Array1OfReal& W) +//! Check rationality of an array of weights +static Standard_Boolean Rational (const TColStd_Array1OfReal& theWeights) { - Standard_Integer i, n = W.Length(); - Standard_Boolean rat = Standard_False; - for (i = 1; i < n; i++) { - rat = Abs(W(i) - W(i+1)) > gp::Resolution(); - if (rat) break; + for (Standard_Integer i = theWeights.Lower(); i < theWeights.Upper(); i++) + { + if (Abs (theWeights[i] - theWeights[i + 1]) > gp::Resolution()) + { + return Standard_True; + } } - return rat; + return Standard_False; } //======================================================================= diff --git a/src/Geom2d/Geom2d_BSplineCurve.cxx b/src/Geom2d/Geom2d_BSplineCurve.cxx index 829e9beeec..1cca78c900 100644 --- a/src/Geom2d/Geom2d_BSplineCurve.cxx +++ b/src/Geom2d/Geom2d_BSplineCurve.cxx @@ -79,20 +79,17 @@ static void CheckCurveData throw Standard_ConstructionError("BSpline curve: # Poles and degree mismatch"); } -//======================================================================= -//function : Rational -//purpose : check rationality of an array of weights -//======================================================================= - -static Standard_Boolean Rational(const TColStd_Array1OfReal& W) +//! Check rationality of an array of weights +static Standard_Boolean Rational (const TColStd_Array1OfReal& theWeights) { - Standard_Integer i, n = W.Length(); - Standard_Boolean rat = Standard_False; - for (i = 1; i < n; i++) { - rat = Abs(W(i) - W(i+1)) > gp::Resolution(); - if (rat) break; + for (Standard_Integer i = theWeights.Lower(); i < theWeights.Upper(); i++) + { + if (Abs (theWeights[i] - theWeights[i + 1]) > gp::Resolution()) + { + return Standard_True; + } } - return rat; + return Standard_False; } //======================================================================= -- 2.20.1