[請益] 求圓周上一點的座標 已知半徑 圓心 30度

作者: leemack (leemack)   2018-12-25 14:03:49
用程式跟高中數學的算法 偶不懂為何 徑度還要再減 pi/2
例如 圚心(3,3) 半徑10 1點鐘方向上的點座標
高中數學
dx=10 x cos (60度) = 5
dy=10 x sin (60度) = 5根號3
點座標 (3+5, 3+5根號3)
程式
#define PI 3.14
#define PI_DIV2 1.57
double fk=5*6*PI/180 - PI_DIV2;
dx=(unsigned short)(rr*cos( fk )) + orx;
dy=(unsigned short)(rr*sin( fk )) + ory;
照常理 應該是
fk= PI_DIV2-5*6*PI/180;
才對啊
先祝大家新年快樂
這兒有一段英文注解但是偶看不憧
// Angles for sin() and cos() start at 3 o'clock;
// subtract HALF_PI to make them start at the top

Links booklink

Contact Us: admin [ a t ] ucptt.com