diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2012-11-12 20:01:12 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-11-12 20:01:12 -0800 |
commit | a154d1ccdc107a052a602afa6f0486f4c5005efc (patch) | |
tree | 152312ecedb6766ae03e640cd9b1b5a1ef903b9e /profile.c | |
parent | 4ce0ce153a254284e32d1a8740484f3029d9d758 (diff) | |
download | subsurface-a154d1ccdc107a052a602afa6f0486f4c5005efc.tar.gz |
Tweak partial pressure plot to avoid printing values ontop of eachh other
This still can look too busy on shallow long dives with moderate vertical
movement.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -540,7 +540,11 @@ static void add_index(int idx, int margin, int **ap, int **a2p, int value) i++; if (a[i] == idx) return; - if (a[i] != -1 && a[i - 1] != -1 && idx - a[i - 1] < margin) + /* already have a POI to the left with the same vertical positiom and too close */ + if ((i > 0 && a[i - 1] != -1 && a2[i - 1] == value && idx - a[i - 1] < margin)) + return; + /* already have a POI to the right with the same vertical positiom and too close */ + if (a[i] != -1 && a2[i] == value && a[i] - idx < margin) return; if (a[i] != -1 && a[i] - idx < margin) return; @@ -615,12 +619,18 @@ static void calculate_spikyness(int nr, double *data, double *spk_data, int delt static gboolean higher_spike(double *spk_data, int idx, int nr, int deltax) { int i; - double s = fabs(spk_data[idx]); - for (i = MAX(0, idx - deltax); i <= MIN(idx + deltax, nr - 1); i++) - if (fabs(spk_data[i]) > s) - return TRUE; - else if (fabs(spk_data[i]) == s && i < idx) + double s = spk_data[idx]; + for (i = MAX(0, idx - deltax); i <= MIN(idx + deltax, nr - 1); i++) { + if (s > 0) { + if (spk_data[i] > s) + return TRUE; + } else { + if (spk_data[i] < s) + return TRUE; + } + if (spk_data[i] == s && i < idx) return TRUE; + } return FALSE; } |