ATAN Function

ATAN (Arc Tangent) Function

It is useful when calculating angles from accelerometers to calculate the angle from a tangent. This function will return the angle (in degrees) from a tangent.

float atan(float tangent){
    //Return atan in degrees
    //returns value between -90 and +90

    float tansign, angle;
    tansign=1;

    if(tangent<0) {
        tansign=-1;
        tangent*=-1;
    }
    if(tangent<=1)
        angle = tansign*((tangent/(1+ 0.28*tangent*tangent))*57.29);
    else
        angle = tansign*(90-((tangent/(tangent*tangent+0.28))*57.29));
       
    return angle;
}

Shopping Cart
0 items
 
DELIVERY/PAYMENT

Free Delivery Orders over £50

UK - £2.40 orders under £50
Airmail from £2.95 (+VAT)
More Details...

 
Brands
 
 Check out our videos
Follow us on:
acebook