The rise and fall of a semidiurnal tide, from a plain running minute count. More...
#include "clock/tide.h"Macros | |
| #define | TIDE_HALF_CUBE ((TIDE_PERIOD_MIN * TIDE_PERIOD_MIN * TIDE_PERIOD_MIN) / 2) |
| Half the cycle's length cubed, rounded down, which rounds the smoothstep to the nearest point. | |
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. |