catmull_rom returning a single point

Hi all,
I am trying to interpolate some data with a *catmull_rom* spline available
in boost math (interpolation). However, the resulting spline collapses to a
single point for all /s/, corresponding to the first control point,
/points_intr[0]/.
Below, the c++ code segment of the interpolation is depicted:
std::vector

Hi there, You will need to normalise (0 - 1) your data set first. To interpolate, you will need to pass normalised values, as well. Then you can unscale the output in the range you want. On Mon, Sep 30, 2019 at 1:51 AM hgrwilson via Boost-users < boost-users@lists.boost.org> wrote:

On 30/09/2019 01:46, hgrwilson via Boost-users wrote:
You're code is *almost* correct, but there is a critical bug: the division (i / num_points) is all-integer-division and so always produces the result 0. Change the call to interpolator_cr((max_s * i) / num_points) and everything is just fine: with 50 points the output I get is: 1.26327 0.774614 1.29431 1.08369 1.56807 1.64688 1.83203 2.27479 1.89198 2.84116 1.8401 3.44126 1.74119 4.03594 1.64816 4.569 1.55777 5.00992 1.46654 5.41294 1.41084 5.84666 1.37552 6.3168 1.38638 6.79263 1.4794 7.25428 1.64023 7.72351 1.88209 8.15832 2.23047 8.50515 2.70565 8.76054 3.26229 8.95583 3.84499 9.12174 4.43925 9.26314 5.07198 9.36489 5.72189 9.44657 6.36711 9.52815 7.00053 9.61229 7.63445 9.68771 8.26827 9.76416 8.90127 9.85153 9.55104 9.95554 10.2167 10.0706 10.8575 10.1904 11.4326 10.3088 11.9145 10.4206 12.3401 10.5325 12.7656 10.6563 13.2034 10.7926 13.64 10.9415 14.079 11.1098 14.5235 11.2964 14.9685 11.5024 15.4066 11.732 15.8379 11.9667 16.2635 12.23 16.6819 12.5679 17.1204 13.0333 17.572 13.5993 17.9852 14.1927 18.3084 14.7404 18.5503 15.2575 18.7269 15.7653 18.7 16.056 As ever, a little debugging goes a long way... HTH, John.
--- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

The problem is in this line:
inter_points = interpolator_cr(max_s * (i / num_points));
i/num_points rounds to zero.
I just reproduced your code with the fix:
#include <iostream>
#include
participants (4)
-
Giorgino R
-
hgrwilson
-
John Maddock
-
Nick Thompson