角度转弧度&根据弧度计算圆周上点的坐标的方法

 

角度转弧度:  

#define AngleToRadian(angle) (M_PI/180.0f)*angle

 

以正东面为0度起点计算指定角度所对应的圆周上的点的坐标:

    float radian = AngleToRadian(angle);

    float x = center.x + cos(radian)*currentAdius;

    float y = center.y + sin(radian)*currentAdius;

  CGPoint point = CGPointMake(x, y);

以正北面为0度起点计算指定角度所对应的圆周上的点的坐标:

    float radian = AngleToRadian(angle); 

    float x = center.x + sinf(radian)*currentAdius;

    float y = center.y - cosf(radian)*currentAdius;    

    CGPoint point = CGPointMake(x, y);

posted @ 2013-08-12 20:29  I'm 小菜鸟  阅读(7324)  评论(0编辑  收藏  举报