Sur*_*rya 8 math geometry pixels
如果我知道圆的中心,圆的半径和垂直角的像素坐标,我如何在圆周上找出一定程度的像素值.基本上,我试图在不同的时间(1点钟,2点钟等)画一个时钟的手
Eri*_*lle 19
设h小时为h=2.250到12之间的浮点数(将是02:15等)(cX,cY)是中心的坐标.hLength并且mLength是时针和分针的长度.
// Hour hand
hAngle = 2.0*Pi*h/12.0; // 0..12 mapped to 0..2*Pi
hX = cX + hLength * sin(hAngle);
hY = cY - hLength * cos(hAngle);
// Min hand
mAngle = 2.0*Pi*h; // 0..1 mapped to 0..2*Pi, etc.
mX = cX + mLength * sin(mAngle);
mY = cY - mLength * cos(mAngle);
Run Code Online (Sandbox Code Playgroud)
小智 9
圆的中心是(X0, Y0),半径是R,与x轴的角度是θ:
X1 = (R * cos theta) + X0
Run Code Online (Sandbox Code Playgroud)
和
Y1 = (R * sin theta) + Y0
Run Code Online (Sandbox Code Playgroud)