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 by
Diff: util/transforms.cpp
- Revision:
- 11:dccbaa9274c5
- Child:
- 14:1cc975207995
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/util/transforms.cpp Sun Mar 08 08:37:38 2015 +0000 @@ -0,0 +1,22 @@ +#include "includes.h" +#include "transforms.h" +#include "fastmath.h" + +void Transforms::Clarke(float a, float b, float *alpha, float *beta) { + *alpha = a; + *beta = (a + 2.0f * b)/sqrt(3.0f); +} + +void Transforms::Parke(float alpha, float beta, float theta, float *d, float *q) { + float cos = FastCos(theta); + float sin = FastSin(theta); + *d = alpha * cos + beta * sin; + *q = -alpha * sin + beta * cos; +} + +void Transforms::InverseParke(float d, float q, float theta, float *alpha, float *beta) { + float cos = FastCos(theta); + float sin = FastSin(theta); + *alpha = cos * d - sin * q; + *beta = sin * d + cos * q; +} \ No newline at end of file