开发者

Coordinates calculation Objective-C

I have the following function that I am so close to cracking but can't find a mod function in obj-c. I hope someone can help suss this.

-(void)estimatePosition{
    float lat1 = 50.000;
    float lon1 = -1.666;
    float d = 500;
    float tc = 90;

    float lat;
    float dlon;
    fl开发者_高级运维oat lon;

    lat =asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc));
    dlon=atan2(sin(tc)*sin(d)*cos(lat1),cos(d)-sin(lat1)*sin(lat));
    lon=mod(lon1-dlon +M_PI,2*M_PI )-M_PI;
}


Since %-operator is only for integers you should use fmod() or fmodf() from <math.h>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜