From: isn Date: Fri, 7 Jun 2019 14:16:06 +0000 (+0300) Subject: linear stream interpolator : insertPoints() : deny to add more points than needed X-Git-Tag: SH_V2_2_0~99^2~11^2~1^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8a924d50eedeb5f1c70fb32925fc1afc4e9d196e;p=modules%2Fhydro.git linear stream interpolator : insertPoints() : deny to add more points than needed --- diff --git a/src/HYDROData/HYDROData_StreamLinearInterpolation.cxx b/src/HYDROData/HYDROData_StreamLinearInterpolation.cxx index 68a06bac..23eab97e 100644 --- a/src/HYDROData/HYDROData_StreamLinearInterpolation.cxx +++ b/src/HYDROData/HYDROData_StreamLinearInterpolation.cxx @@ -107,7 +107,7 @@ static void GetMaxDist(const std::vector& PNTS, static void InsertPoints(std::vector& points, int nbpoints) { points.reserve(points.size() + nbpoints); - while (nbpoints) + while (nbpoints>0) { double dmax=0, dmax2=0; int imax=-1; @@ -124,6 +124,8 @@ static void InsertPoints(std::vector& points, int nbpoints) double Y0 = p1.Y(); double X1 = p2.X(); double Y1 = p2.Y(); + if (nbPins>nbpoints) //deny to add more points than needed + nbPins = nbpoints; for (int i=0;i& points, int nbpoints) } nbpoints-=nbPins; } + assert (nbpoints == 0); } static void PolyToCurve2d(const Handle(HYDROData_PolylineXY)& poly, Handle(Geom2d_Curve)& c2d)