-/*
- * Find the next minimum/maximum point.
- *
- * We exit early if we hit "enough" of a depth reversal,
- * which is roughly 10 feet.
- */
-static struct sample *next_minmax(struct sample *sample, struct sample *end, int minmax)
-{
- const int enough = 3000;
- struct sample *result;
- int depthlimit;
-
- if (sample >= end)
- return 0;
-
- depthlimit = sample->depth.mm;
- result = NULL;
-
- for (;;) {
- int depth;
-
- sample++;
- if (sample >= end)
- return NULL;
- depth = sample->depth.mm;
-
- if (minmax) {
- if (depth <= depthlimit) {
- if (depthlimit - depth > enough)
- break;
- continue;
- }
- } else {
- if (depth >= depthlimit) {
- if (depth - depthlimit > enough)
- break;
- continue;
- }
- }
-
- result = sample;
- depthlimit = depth;
- }
- return result;
-}
-
-static void plot_text_samples(struct graphics_context *gc, struct sample *a, struct sample *b)