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.
Fork of priustroller_current by
fastmath.cpp@9:d3b70c15baa9, 2015-03-06 (annotated)
- Committer:
- nki
- Date:
- Fri Mar 06 19:12:53 2015 +0000
- Revision:
- 9:d3b70c15baa9
loop is closed.;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| nki | 9:d3b70c15baa9 | 1 | #include "includes.h" |
| nki | 9:d3b70c15baa9 | 2 | #include "fastmath.h" |
| nki | 9:d3b70c15baa9 | 3 | #include "lut.h" |
| nki | 9:d3b70c15baa9 | 4 | |
| nki | 9:d3b70c15baa9 | 5 | float FastMath::FastSin(float theta) { |
| nki | 9:d3b70c15baa9 | 6 | if (theta < 0.0f) theta += 360.0f; |
| nki | 9:d3b70c15baa9 | 7 | if (theta >= 360.0f) theta -= 360.0f; |
| nki | 9:d3b70c15baa9 | 8 | return 2.0f * sinetab[(int) theta] - 1.0f; |
| nki | 9:d3b70c15baa9 | 9 | } |
| nki | 9:d3b70c15baa9 | 10 | |
| nki | 9:d3b70c15baa9 | 11 | float FastMath::FastCos(float theta) { |
| nki | 9:d3b70c15baa9 | 12 | return FastSin(90.0f - theta); |
| nki | 9:d3b70c15baa9 | 13 | } |
| nki | 9:d3b70c15baa9 | 14 | |
| nki | 9:d3b70c15baa9 | 15 | float FastMath::FastSin01(float theta) { |
| nki | 9:d3b70c15baa9 | 16 | return FastSin(theta) * 0.5f + 0.5f; |
| nki | 9:d3b70c15baa9 | 17 | } |
| nki | 9:d3b70c15baa9 | 18 | |
| nki | 9:d3b70c15baa9 | 19 | float FastMath::FastCos01(float theta) { |
| nki | 9:d3b70c15baa9 | 20 | return FastCos(theta) * 0.5f + 0.5f; |
| nki | 9:d3b70c15baa9 | 21 | } |
