From 8a924d50eedeb5f1c70fb32925fc1afc4e9d196e Mon Sep 17 00:00:00 2001 From: isn Date: Fri, 7 Jun 2019 17:16:06 +0300 Subject: [PATCH] linear stream interpolator : insertPoints() : deny to add more points than needed --- src/HYDROData/HYDROData_StreamLinearInterpolation.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- 2.39.2