高级会员
 
主题
帖子
积分549
阅读权限30
注册时间2014-12-12
最后登录1970-1-1
在线时间 小时
|

楼主 |
发表于 2015-11-25 09:03
|
显示全部楼层
本帖最后由 yyhxxnr 于 2015-11-25 09:16 编辑
末端不会算? 能具体说说么.
要是指针末端的话,你看看这个 http://home.eeworld.com.cn/my/space-uid-466873-blogid-119781.html
/*************************************************** 函数名称:LcdTimeX(uint8 Length,uint8 Angle) 函数功能:计算指针的X坐标 输入参数:circle_x:圆心横坐标 Length :半径长度 Angle :角度 输出参数: x坐标 ****************************************************/ unsigned char Lcd_TimeX(unsigned char circle_x,unsigned char Length,unsigned char Angle) { unsigned char x; if((Angle>0) && (Angle<=15)) { x = circle_x + Length * (sin(PI * Angle / 30)); } else if(Angle > 15 && Angle <= 30) { x = circle_x + Length * cos((PI * Angle) / 30 - (PI / 2 )); } else if(Angle > 30 && Angle <= 45) { x = circle_x - Length * sin((PI * Angle) / 30- PI); } else { x = circle_x-Length * cos((PI * Angle) / 30 - ((3 * PI) / 2)); } return x; }
/*************************************************** 函数名称:LcdTimeY(uint8 Length,uint8 Angle) 函数功能:计算指针的Y坐标 输入参数:circle_y:圆心纵坐标 Length :半径长度 Angle :角度 输出参数: Y坐标 ****************************************************/ unsigned char Lcd_TimeY(unsigned char circle_y,unsigned char Length,unsigned char Angle) { unsigned char y; if((Angle>0) && (Angle<=15)) { y = circle_y - Length * (cos(PI * Angle / 30)); } else if(Angle > 15 && Angle <= 30) { y = circle_y + Length * sin((PI * Angle) / 30 - (PI / 2 )); } else if(Angle > 30 && Angle <= 45) { y = circle_y + Length * cos((PI * Angle) / 30- PI); } else { y = circle_y - Length * sin((PI * Angle) / 30 - ((3 * PI) / 2)); } return y; }
|
|