我目前正在构建一个小型指南针应用程序,并使用简单的圆方程绘制了南北线:x= a+r Cos(t) and y= b+ r Sin(t) where t=heading or direction in degree(angle )。更多信息在 Wiki
到目前为止,我已经设法获得了南北线。这是我的工作
//canvas.drawLine(startX, startY, stopX, stopY, paint)
//Drawing North
canvas.drawLine(cxCompass, cyCompass,
(float)(cxCompass + radiusCompass * Math.sin((double)(-direction) * 3.14/180)),
(float)(cyCompass - radiusCompass * Math.cos((double)(-direction) * 3.14/180)),
paint);
//Drawing South
canvas.drawLine(cxCompass, cyCompass,
(float)(cxCompass - radiusCompass * Math.sin((double)(-direction) * 3.14/180)),
(float)(cyCompass + radiusCompass * Math.cos((double)(-direction) * 3.14/180)),
paint);
我的问题:我不知道我们如何获得东西线?
CxCompass, CyCompass:圆心坐标