05-16-2018, 05:04 PM
In order to do certain trig functions, I added three new ones to a project, all conveniently based on existing CORE angle functions to "safely" calculate values. The functions are for cotangent, secant, and cosecant.
Then again, if what I have here works reliably and correctly, perhaps this will work just as well. I hope it can be of use to others.
Thanks for the excellent Angle class!
Code:
double trig::Plugin::cot(double rad){
double val = 0;
if (rad == 0)
return 0;
val = hdi::core::Angle(rad).tan();
if (val == 0)
return 0;
return 1/val;
}
double trig::Plugin::cec(double rad){
double val = 0;
if (rad == 0)
return 0;
val = hdi::core::Angle(rad).cos();
if (val == 0)
return 0;
return 1/val;
}
double trig::Plugin::csc(double rad){
double val = 0;
if (rad == 0)
return 0;
val = hdi::core::Angle(rad).sin();
if (val == 0)
return 0;
return 1/val;
}
Then again, if what I have here works reliably and correctly, perhaps this will work just as well. I hope it can be of use to others.
Thanks for the excellent Angle class!