Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE mbed wave_player
Fork of MazeRunner_Fall2017-shell by
math_extra.h@1:2c6ae0fe9a2a, 2017-12-29 (annotated)
- Committer:
- navaem
- Date:
- Fri Dec 29 15:32:31 2017 +0000
- Revision:
- 1:2c6ae0fe9a2a
- Parent:
- 0:cf4396614a79
December 29, 2017;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| rconnorlawson | 0:cf4396614a79 | 1 | #pragma once |
| rconnorlawson | 0:cf4396614a79 | 2 | |
| navaem | 1:2c6ae0fe9a2a | 3 | #include <math.h> |
| navaem | 1:2c6ae0fe9a2a | 4 | |
| navaem | 1:2c6ae0fe9a2a | 5 | |
| rconnorlawson | 0:cf4396614a79 | 6 | // True if lower < x < upper |
| rconnorlawson | 0:cf4396614a79 | 7 | int in_range(int x, int lower, int upper); |
| rconnorlawson | 0:cf4396614a79 | 8 | |
| rconnorlawson | 0:cf4396614a79 | 9 | // Clamps the value of x to the range [-limit, limit] |
| rconnorlawson | 0:cf4396614a79 | 10 | float clamp(float x, float limit); |
| rconnorlawson | 0:cf4396614a79 | 11 | |
| rconnorlawson | 0:cf4396614a79 | 12 | // Returns the sign of x (-1, 0, or 1). |
| rconnorlawson | 0:cf4396614a79 | 13 | int sgn(float x); |
| rconnorlawson | 0:cf4396614a79 | 14 | |
| rconnorlawson | 0:cf4396614a79 | 15 | // Returns either -1.0 or 1.0, randomly |
| navaem | 1:2c6ae0fe9a2a | 16 | //float coin_flip(); |
| navaem | 1:2c6ae0fe9a2a | 17 | |
| navaem | 1:2c6ae0fe9a2a | 18 | //calculate the magnitude of the cross product |
| navaem | 1:2c6ae0fe9a2a | 19 | float cross(float x1, float y1,float x2,float y2); |
