About   |   Getting Started   |   Downloads   |   Documentation   |   Forum


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
new angle functions
05-16-2018, 05:04 PM
Post: #1
new angle functions
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.

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!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)