Precise drawing after grouping max/min points?
Posted: Mon Mar 21, 2016 12:06 pm
I'm about to draw somethings like 882 points inside a window of (horizontally) 200 pixel. As tulamide suggested to me time ago, it's worthless to draw each point, since I'll max draw 200 of them. So I'll group block of them (882/5=177 points) using min/max points to draw it (Mem to Float Array Min/Max prim):
as you can see in this "analysis" (you can switch between original points and grouped version), blu points are the original, reds the min and yellow the max, for each group.
Now, what I need to do is to "join" those points, getting the same signal and keeping (that's the important aspect) min/max value for each peak. My idea is:
- start from index t=0.
- When the next max is increasing, use current max point (yellow one)
- When the next max is decreasing, use current min point (red one)
it seems to works very well (you can see the white line is taking the points it should take). But this don't always works. In fact at the 4° change of slope, this is not true. It should take in order red-red-red-yellow-yellow. But with my method, its red-red-red-red-yellow (because between the 3° and 4° yellow there is a decreasing):
so, a defect in the curve.
How would you fix it? I mean: how would you choose points (after resampling with min/max) that exactly hover original signal? (i.e. the meaning of this "grouping points" task)?
Hope you can help me! Thanks dudes!
as you can see in this "analysis" (you can switch between original points and grouped version), blu points are the original, reds the min and yellow the max, for each group.
Now, what I need to do is to "join" those points, getting the same signal and keeping (that's the important aspect) min/max value for each peak. My idea is:
- start from index t=0.
- When the next max is increasing, use current max point (yellow one)
- When the next max is decreasing, use current min point (red one)
it seems to works very well (you can see the white line is taking the points it should take). But this don't always works. In fact at the 4° change of slope, this is not true. It should take in order red-red-red-yellow-yellow. But with my method, its red-red-red-red-yellow (because between the 3° and 4° yellow there is a decreasing):
so, a defect in the curve.
How would you fix it? I mean: how would you choose points (after resampling with min/max) that exactly hover original signal? (i.e. the meaning of this "grouping points" task)?
Hope you can help me! Thanks dudes!