求教曲线拟合问题!!!!!!!!!!!回答完整者全分!!! 请问如何在Dephi里解决曲线拟合问题啊,根据数据库提供的数据如何自动进行拟合,怎么样定位坐标等相关的因素 谢谢!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 就是在Dephi里面实现曲线绘图功能,给段代码,问:如何改变曲线的颜色和如何定位坐标? PolyBezier()曲线拟合这是三点拟合的程序.unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;type TForm1 = class(TForm) PaintBox1: TPaintBox; Button1: TButton; procedure PaintBox1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure Button1Click(Sender: TObject); private { Private declarations } Index: Byte; Point: array [1..3] of TPoint; procedure Par(xs, ys, xm, ym, xe, ye: Integer); public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}{ TForm1 }procedure TForm1.Par(xs, ys, xm, ym, xe, ye: Integer);var d, d1, ax, ay, bx, by: Double; n, i: Integer;begin ax:=(xe-2*xm+xs)*2; ay:=(ye-2*ym+ys)*2; bx:=xe-xs-ax; by:=ye-ys-ay; n:=Trunc(Sqrt(ax*ax+ay*ay)); n:=Trunc(Sqrt(n*100)); PaintBox1.Canvas.MoveTo(xs, ys); d:=1/n; d1:=d; for i:=0 to n do begin PaintBox1.Canvas.LineTo(Trunc(ax*d1*d1+bx*d1+xs), Trunc(ay*d1*d1+by*d1+ys)); d1:=d1+d; end; PaintBox1.Canvas.LineTo(xe, ye)end;procedure TForm1.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin Inc(Index); if Index<4 then begin Point[Index].X:=x; Point[Index].Y:=y; PaintBox1.Canvas.Pixels[x,y]:=clred; end;end;procedure TForm1.Button1Click(Sender: TObject);begin Index:=0; Par(Point[1].X, Point[1].Y, Point[2].X, Point[2].Y, Point[3].X, Point[3].Y);end;end. 方法怎么返回值,以及在另一方法中怎么接收返回值 delphi2007无法使用以下代码? 谢谢啦 界面图形问题 如何取得一个目录下时间最新的文件? Delphi 在98下和2k下的时间查找问题! 如何改变inputbox函数中的字体???? 这个sql怎么写,对两个表查询? 急:(100分酬谢)如何写密码确认的代码(在线等候) 请高人指教,小弟是新手,实在是找不出错误在哪里? 一个简单问题,但是不好下手,大家来帮忙啊!(关于在DBGrid中编辑数据) 关于网页数据提取算法问题,顺便散散分;
PolyBezier()曲线拟合这是三点拟合的程序.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
PaintBox1: TPaintBox;
Button1: TButton;
procedure PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
Index: Byte;
Point: array [1..3] of TPoint; procedure Par(xs, ys, xm, ym, xe, ye: Integer);
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}{ TForm1 }procedure TForm1.Par(xs, ys, xm, ym, xe, ye: Integer);
var
d, d1, ax, ay, bx, by: Double;
n, i: Integer;
begin
ax:=(xe-2*xm+xs)*2;
ay:=(ye-2*ym+ys)*2;
bx:=xe-xs-ax;
by:=ye-ys-ay;
n:=Trunc(Sqrt(ax*ax+ay*ay));
n:=Trunc(Sqrt(n*100));
PaintBox1.Canvas.MoveTo(xs, ys);
d:=1/n;
d1:=d;
for i:=0 to n do
begin
PaintBox1.Canvas.LineTo(Trunc(ax*d1*d1+bx*d1+xs), Trunc(ay*d1*d1+by*d1+ys));
d1:=d1+d;
end;
PaintBox1.Canvas.LineTo(xe, ye)
end;procedure TForm1.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Inc(Index);
if Index<4 then
begin
Point[Index].X:=x;
Point[Index].Y:=y;
PaintBox1.Canvas.Pixels[x,y]:=clred;
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
Index:=0;
Par(Point[1].X, Point[1].Y, Point[2].X, Point[2].Y, Point[3].X, Point[3].Y);
end;end.