时钟指针取点函数

#include 
#include 
#include 

#define PI  3.1415926
#define Min_Cal 0
//圆心195,140
//min_r = 55  step=6; hour_r = 40 ,step=3
int x=195,y=140;
int data[100][2];
#if Min_Cal
    int r = 55;
    int step_du = 6; 
#else
    int r = 40; 
    int step_du = 3;  
#endif

int main(int argc, char *argv[]) {
    
    int i=0,j=0;
    int du=0;    /*角度 */
    for(i=0,j=0;i<360;i+=step_du,j++)
    {
        data[j][0] = x-r*sin(du*PI/180);
        data[j][1] = y-r*cos(du*PI/180);
        du+=step_du; /*一次加多少°*/ 
    }
    
    data[60][0] =x;
    data[60][1] = y-r;
    j-=1;
    printf("{%d,%d},",data[0][0],data[0][1]);
    for(;j>=0;j--)
    {
        printf("{%d,%d},",data[j][0],data[j][1]);
    }
    return 0;
}

你可能感兴趣的:(时钟指针取点函数)