thanks for the brush up of high school math, very much needed here eheh
I looked at your example, and you guessed right, I was indeed trying to find a general approach to resample a curve based on a density ramp.
Unfortunately it seems still occurring the mess up with the point overlapping.
I really wanted to find a mathematical solution to the problem, trying to link a function (in our case the ramp) to the resolution of a line. I guess there's some calculus involved?
Anyway, after lots of trial and error, I gave up to do it in a pure mathematical fashion (but still super curious about it!!), and went full brute-force
I ended up with an approach that seems to give pretty solid results: even if I'm not sure about the mathematical correctness of it, the point distribution seems to follow nicely the ramp, without overlapping.
So far I noticed 2 short comings:
- it's brute force, it works with exponential amount of your desired point resolution (exponent depend on the precision you need)so you can't have a high target resolution
- especially when you work with low points, it seems that the first point is missing. That's because of the final downsampling technique involved (delete points in 1 of 2 points step * n amounts of times). This could be fixed, I guess, by restoring the original ends point of the curve.
- Could anybody validate the correctness of the feedback loop inside? I have the feeling that sometimes it would loop only 1 time, regardless of how you set the value of the “precision” parameter that should drive the number of iterations of the loop. I'm pretty sure that I have seen a undesired final amount of points ( > than the set resolution that I set). But I can't really reproduce this behavior.
Thanks again for your supervision, cheers