跳至主要內容

Math.tan


Math.tan

函数原型

float Math.tan(float x);

功能

正切

说明

计算tan(x),x为弧度值

示例

#define Pi 3.14159265

void main()
{
    int i, x1, y1, x2, y2;
    x1 = 20;
    y1 = 40;
    Line(15, 75, 145, 75, 1);
    Line(20, 0, 20, 79, 1);
    for (i = 1; i <= 80; i++) {
        x2 = x1 + 1;
        y2 = 75 - Math.tan(i * Pi / 180) * 13 + 0.5;
        Line(x1, y1, x2, y2, 1);
        x1 = x2;
        y1 = y2;
    }
    getchar();
}