The rise and fall of a semidiurnal tide, from a plain running minute count. More...
#include "clock/tide.h"Macros | |
| #define | TIDE_PERIOD_CUBE ((int64_t)TIDE_PERIOD_MIN * TIDE_PERIOD_MIN * TIDE_PERIOD_MIN) |
| The cycle's length cubed, which the smoothstep divides by. | |
Functions | |
| static int32_t | phase (int32_t minutes) |
| Where in the cycle a minute count lands. | |
| int | tide_level (int32_t minutes) |
| How far in the tide is, from 0 at dead low to 100 at high water. | |
| bool | tide_rising (int32_t minutes) |
| Whether the tide is on its way in. | |
The rise and fall of a semidiurnal tide, from a plain running minute count.
|
static |
Where in the cycle a minute count lands.
C truncates a negative division towards zero, which leaves a negative remainder, so this pulls it back up by hand.
| minutes | A running minute count, on the same base as tide_level. |