Math.cos
Math.cos
函数原型
float Math.cos(float x);
功能
余弦
说明
计算cos(x),x为弧度值
示例
#define Pi 3.14159265
void main()
{
int i, x1, y1, x2, y2;
x1 = 20;
y1 = 40;
Line(15, 40, 145, 40, 1);
Line(20, 0, 20, 79, 1);
for (i = 3; i <= 360; i = i + 3) {
x2 = x1 + 1;
y2 = 40 - Math.cos(i * Pi / 180) * 36 + 0.5;
Line(x1, y1, x2, y2, 1);
x1 = x2;
y1 = y2;
}
getchar();
}