@@ -35,7 +35,7 @@ namespace points {
3535// / index. This can be subsequently used to modify
3636// / the replicated points as a post process.
3737template <typename PointDataGridT>
38- inline typename PointDataGridT::Ptr
38+ typename PointDataGridT::Ptr
3939replicate (const PointDataGridT& source,
4040 const Index multiplier,
4141 const std::vector<std::string>& attributes,
@@ -56,7 +56,7 @@ replicate(const PointDataGridT& source,
5656// / index. This can be subsequently used to modify
5757// / the replicated points as a post process.
5858template <typename PointDataGridT>
59- inline typename PointDataGridT::Ptr
59+ typename PointDataGridT::Ptr
6060replicate (const PointDataGridT& source,
6161 const Index multiplier,
6262 const std::string& scaleAttribute = " " ,
@@ -67,7 +67,7 @@ replicate(const PointDataGridT& source,
6767
6868
6969template <typename PointDataGridT>
70- inline typename PointDataGridT::Ptr
70+ typename PointDataGridT::Ptr
7171replicate (const PointDataGridT& source,
7272 const Index multiplier,
7373 const std::vector<std::string>& attributes,
@@ -279,19 +279,21 @@ replicate(const PointDataGridT& source,
279279 idxHandle.expand (/* fill*/ false );
280280 assert (idxHandle.size () == total);
281281
282+
283+ Index offset = 0 ;
284+
282285 if (useScale) {
283- Index offset = 0 ;
284286 for (Index i = 0 ; i < sourceCount; ++i) {
285287 const Index pointRepCount = getPointsToGenerate (i);
286- for (Index j = 0 ; j < pointRepCount; ++j, ++offset ) {
287- idxHandle.set (offset, j);
288+ for (Index j = 0 ; j < pointRepCount; ++j) {
289+ idxHandle.set (offset++ , j);
288290 }
289291 }
290292 }
291293 else {
292- for (Index i = 0 ; i < total; ) {
293- for (Index j = 0 ; j < uniformMultiplier; ++j, ++i ) {
294- idxHandle.set (i , j);
294+ while (offset < total) {
295+ for (Index j = 0 ; j < uniformMultiplier; ++j) {
296+ idxHandle.set (offset++ , j);
295297 }
296298 }
297299 }
@@ -308,7 +310,7 @@ replicate(const PointDataGridT& source,
308310}
309311
310312template <typename PointDataGridT>
311- inline typename PointDataGridT::Ptr
313+ typename PointDataGridT::Ptr
312314replicate (const PointDataGridT& source,
313315 const Index multiplier,
314316 const std::string& scaleAttribute,
0 commit comments