请问如何在Dephi里解决曲线拟合问题啊,根据数据库提供的数据如何自动进行拟合,怎么样定位坐标等相关的因素
谢谢!!!
谢谢!!!
解决方案 »
- 关于label.caption属性简单又复杂的问题
- 提供大型项目源码 - 学习Delphi/SQL编程的绝好案例
- 如何做这样的东西?
- 从邮件服务器上的下载邮件后,怎样显示正常的文字?
- WebBrowser 出现 Invalid floating point operation 如何处理?
- 使用EXPRESS的SQLQUERY中 出现不能操作的提示!!!
- 有没有这样一个函数?
- 局域网时间同步问题。
- 谁知道那有pascal编辑环境下载?
- hedong(电脑动能)、amei2000go(浪子)请进来拿分!--->“急,关于报表的,无论高手低手都一律请入,分数陆续会加到600分!分数必分,决不食言!(VB转Delphi者求助!)”(little_hero)
- 一个简单问题,但是不好下手,大家来帮忙啊!(关于在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.