I am writing a function in C that returns the radius of an ellipse at a given angle with a given length and width; Basically writing this calculation in C:
Unfortunately the platform does not support math.h
however there are sin
and cos
functions built in that I can use.
How do I write this calculation in C and store it in an int
?
I have tried:
int theta = 90;
int a = 164;
int b = 144;
float aa = (((a^2) * ((sin_lookup(DEG_TO_TRIGANGLE(theta)))^2)) +
((b^2) * ((cos_lookup(DEG_TO_TRIGANGLE(theta)))^2))) /
(TRIG_MAX_ANGLE^2);
float result = (a * b) / (my_sqrt(aa));
int value = (int)result;