有啊 用y=cos(x)即可
这是以前的一个画余玄曲线的东东 很简单的
下面是完整的代码:
----------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var i,j:integer; x,y:real;
halfheight:integer;
begin
halfheight:=form1.Height div 2;
for i:=1 to trunc(form1.Width) do
begin
x:=i*(4*PI/form1.Width);
y:=cos(x); //halfheight*0.7
j:=trunc(y*100)+halfheight;
canvas.Pixels[i,j]:=clred;
end;
x:=3*form1.Width/4; //画竖线
i:=trunc(x);
with canvas do
begin
pen.Color:=clblue;
moveto(i,0);
lineto(i,form1.Height);
end;
end;
procedure TForm1.FormPaint(Sender: TObject);
var x,y:real;i,j:integer;
begin
x:=form1.Width/4; //坐标系
i:=trunc(x);
y:=form1.Height/2;
j:=trunc
;
with canvas do
begin
moveto(i,0);
lineto(i,form1.Height);
moveto(0,j);
lineto(form1.Width,j);
end;
end;
end.