, , , , . .
.
3.1 .
, .
, Sm. ti :
1) 0 ≤ ti ≤ t1;
2) t1 ≤ ti ≤ t2;
3) t2 ≤ ti ≤ Tf.
:
1) f1II (k) = 2/k1(1-k1+k2);
2) f2II(k) = 0;
3) f3II(k) = (-2)/(1-k1)(1-k1+k2).
(1) , f1I(k) f1(k):
f1I(k) = ∫ f1II (k)dk = ∫2dk/k1(1-k1+k2) = 2k/k1(1-k1+k2) + C1;
f1(k) = ∫ f1I (k)dk = ∫(2k/k1(1-k1+k2) + C1)dk = (k^2)/k1(1-k1+k2) + C1*k + C2.
: k = 0, f1I(k) = 0, f1(k) = 0 =>C1 = C2 = 0.
f1I(k) = 2k/k1(1-k1+k2), f1(k) = (k^2)/k1(1-k1+k2).
k=ti/Tf, k1=t1/Tfk2=t2/Tf , a1(ti), V1(ti) S1(ti):
a1(ti) = (Sm/Tf^2) * 2Tf/(t1*(Tf-t1+t2));
V1(ti) = (Sm/Tf) * 2ti/(t1*(Tf-t1+t2));
S1(ti) = Sm * ti/(Tf*ti*(Tf-t1+t2)).
(2) , f2I(k) f2(k):
f2I(k) = ∫ f2II (k)dk = C1;
f2(k) = ∫ f2I (k)dk = C1*k + C2.
: k=k1, f2I(k) = f1I(k), f2(k) = f1(k)=>
C1 = 2/(1-k1+k2), C2 = k1/(1-k1+k2) 2k1/(1-k1+k2) = -k1/(1-k1+k2).
f2I(k) = 2/(1-k1+k2), f2(k) = 2k/(1-k1+k2) k1 /(1-k1+k2) = (2k-k1)/(1-k1+k2).
k=ti/Tf, k1=t1/Tfk2=t2/Tf , a2(ti), V2(ti) S2(ti):
a2(ti) = 0;
V2(ti) = (Sm/Tf) * 2Tf/(Tf-t1+t2);
S2(ti) = Sm * (2ti-t1)/(Tf-t1+t2).
(3) , f3I(k) f3(k):
f3I(k) = ∫ f3II (k)dk = ∫(-2dk)/(1-k1)(1-k1+k2) = (-2k)/(1-k1)(1-k1+k2) + C1;
f3(k) = ∫ f3I (k)dk = ∫ [(-2k)/(1-k1)(1-k1+k2) + C1]dk = (-k^2)/(1-k1)*(1-k1+k2) +
+ C1*k + C2.
: k=1, f3I(k)=0, f3(k)=1 =>
C1 = 2/(1-k1)(1-k1+k2), C2 = 1 + 1/(1-k1)(1-k1+k2) 2/(1-k1)(1-k1+k2) =
= [(1-k1)(1-k1+k2) 1]/(1-k1)(1-k1+k2).
f3I(k) = (-2k+2)/(1-k1)(1-k1+k2);
f3(k) = [-(k^2) + 2k + (1-k1)(1-k1+k2) 1]/(1-k1)(1-k1+k2).
k=ti/Tf, k1=t1/Tfk2=t2/Tf , a3(ti), V3(ti) S3(ti):
|
|
a3(ti) = (Sm/Tf^2) * (-2Tf)/(Tf-t1)(Tf-t1+t2);
V3(ti) = (Sm/Tf) * (-2ti + 2Tf)/(Tf-t1)(Tf-t1+t2);
S3(ti) = Sm * [-ti^2 + 2ti*Tf +Tf(Tf-t1)(Tf-t1+t2)-Tf^2]/Tf(Tf-t1)(Tf-t1+t2).
3.2. .
, .
, Sm. ti : 0 ≤ ti≤Tf.
:
fII(k) = (0,5*π^2)*cosπk.
, fI(k) f(k):
fI(k) = ∫ fII(k)dk = ∫ (0,5*π^2)*cosπkdk = (0,5*π)*sinπk + C1;
f(k) = ∫ fI(k)dk = ∫ [(0,5*π)*sinπk + C1]dk = -0,5*cosπk + C1*k + C2.
: k=0, fI(k)=0, fI(k)=0 =>C1=0, C2=0,5.
fI(k) = (0,5*π)*sinπk, f(k) = 0,5*(1 cosπk).
k=ti/Tf , a(ti), V(ti) S(ti):
a(ti) = (Sm/Tf^2) * (0,5*π^2)*cos(π*ti/Tf);
V(ti) = (Sm/Tf) * (0,5*π)*sin(π*ti/Tf);
S(ti) = Sm * 0,5*(1 cos(π*ti/Tf)).
3.3. .
, .
, φm. 0 ≤ ti ≤ Tf.
:
fII(k) = 6(1-2k).
, fI(k) f(k):
fI(k) = ∫ fII(k)dk = ∫ 6(1-2k)dk = 6k 6k^2 + C1;
f(k) = ∫ fI(k)dk = ∫ (6k 6k^2 + C1)dk = 3k^2 2k^3 + C1*k + C2.
: k=0, fI(k)=0, f(k)=0 =>C1=C2=0.
fI(k) = 6k * (1-k), f(k) = (k^2) * (3-2k).
k=ti/Tf , a(ti), V(ti) S(ti):
a(ti) = (Sm/Tf^2) * 6(1-(ti/Tf));
V(ti) = (Sm/Tf) * [6ti*(Tf-ti)]/Tf;
S(ti) = Sm * [(ti^2)*(3*(Tf^2)-2ti*Tf)].
.
TZveno - TMOnward ( ) TMRotate ( ). TMRobot -, .
TLaw_Common - : TLawA4, TLawB5 TLawC8. TLaw_movement -, .
TZveno : FX, FY, FX0, FY0, FColor; : constructor create; : destructor Destroy; : SetColor, SetX, SetY, SetX0, SetY0, Paint, Move; : X, Y, X0, Y0, Color. |
TMOnward : FX, FY, FX0, FY0, FColor, FWidth, FHeight, FPostHeight; : constructor create; : destructor Destroy; : SetWidth, SetHeight, SetPostHeight, SetColor, SetX, SetY, SetX0, SetY0, Paint, Move; : X, Y, X0, Y0, Color, Width, Height, PostHeight. |
TMRotate : FX, FY, FX0, FY0, FColor,FLength, FRadius, F0, F; : constructor create; : destructor Destroy; : SetLength, SetRadius, SetFi0, SetFi, SetColor, SetX, SetY, SetX0, SetY0, Paint, Move; : X, Y, X0, Y0, Color, Length, Radius, Fi0, Fi. |
|
|
TMRobot : MOnwardA, MOnwardB, MRotateC, FX, FY, FX0, FY0, FColor, FWidth, FHeight, FPostHeight, FLength, FRadius, F0, F, FTimer, FBitmap; : constructor create; : destructor Destroy; : SetColor, SetX, SetY, SetX0, SetY0, Paint, Move, SetLength, SetRadius, SetFi0, SetFi,SetWidth, SetHeight, SetPostHeight, Start, Stop; : X, Y, X0, Y0, Color, Length, Radius, Fi0, Fi, Width, Height, PostHeight. |
TLaw_Common : CTf, Cti, CN, Cni, Ct1, Ct2; : constructor create; : destructor Destroy; : SetTf, SetN, Sett1, Sett2; : Tf, N. t1, t2. |
TLawC8 : CTf, Cti, CN, Cni, CFimin, CFimax; : constructor create; : destructor Destroy; : SetTf, SetN, SetFimax, SetFimin, e, w, fi; : Tf, N,Fimax, Fimin. |
TLawA4 : CTf, Cti, CN, Cni, Ct1, Ct2, CSm; : constructor create; : destructor Destroy; : SetTf, SetN, Sett1, Sett2, SetSm, a, v, s; : Tf, N. t1, t2, Sm. |
TLawB5 : CTf, Cti, CN, Cni, CSm; : constructor create; : destructor Destroy; : SetTf, SetN, SetSm, a, v, s; : Tf, N,Sm. |
TLaw_movement : CTf, Cti, CN, Cni, Ct1, Ct2, CSm, CFimax, CFimin; : constructor create; : destructor Destroy; : SetTf, SetN, Sett1, Sett2, SetFimax, SetFimin, SetSm, a, v, s, e, w, fi; : Tf, N. t1, t2, Fimax, Fimin, Sm. |
.
unit Unit1; // ()
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus, ComCtrls, RUnit, shellapi;
procedure ShowLogo(Handle:THandle)stdcall;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
btn2: TButton;
procedure FormCreate(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure btn2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
procedure ShowLogo; external 'Project.dll' index 11; //
procedure ShowProg; external 'Project.dll' index 12; //
procedure ShowDev; external 'Project.dll' index 13; //
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.Visible:=False;
ShowLogo(Handle); //
end;
procedure TForm1.N8Click(Sender: TObject);
begin
Form1.Close; //
end;
procedure TForm1.N4Click(Sender: TObject);
begin
Form1.Close;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Form1.Close;
end;
procedure TForm1.btn2Click(Sender: TObject);
begin
|
|
Form3.Show; //
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowProg; //
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
ShowDev; //
end;
procedure TForm1.N1Click(Sender: TObject);
begin
ShowProg;
end;
procedure TForm1.N3Click(Sender: TObject);
begin
ShowDev;
end;
procedure TForm1.N5Click(Sender: TObject);
begin
ShowProg;
end;
procedure TForm1.N7Click(Sender: TObject);
begin
ShowDev;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ShellExecute(0, nil, 'DelphiBeginner.chm', nil,nil, SW_SHOWNORMAL); {Delphi, }
end;
procedure TForm1.N2Click(Sender: TObject);
begin
ShellExecute(0, nil, 'DelphiBeginner.chm', nil,nil, SW_SHOWNORMAL);
end;
procedure TForm1.N6Click(Sender: TObject);
begin
ShellExecute(0, nil, 'DelphiBeginner.chm', nil,nil, SW_SHOWNORMAL);
end;
end.//
unitRUnit; //
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ClUnit, Math;
type
TForm3 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
edt1: TEdit;
edt2: TEdit;
edt3: TEdit;
edt4: TEdit;
edt5: TEdit;
edt6: TEdit;
edt7: TEdit;
pnl1: TPanel;
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
Robot: TMRobot;
Law_Movement:TLaw_Movement;
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Form1.Refresh;
Robot:= TMRobot.Create;
Tf:= StrToInt(Form1.edt4.Text);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Robot.Free;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Robot:=TMRobot.Create(Self);
Robot.Parent:=pnl1;
end;
end. //
unit ClUnit; //
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Math;
type
TLaw_Common = class // -
CTf:Double; //
Cti:double; // ( )
CN:Integer; //
Cni:byte; // ( )
Ct1, Ct2: Double; //
procedure SetTf(const Value: Double); virtual; abstract;
procedure SetN(const Value: Integer); virtual; abstract;
procedure Sett1(const Value: Double); virtual; abstract;
procedure Sett2(const Value: Double); virtual; abstract;
public
constructor Create;virtual; abstract; //
destructor Destroy; virtual; abstract; //
property Tf:Double read CTf write SetTf;
property N:Integer read CN write SetN;
property t1:Double read Ct1 write Sett1;
property t2:Double read Ct2 write Sett2;
end;
TLawA4 = class(TLaw_Common)
CTf: Double;
Cti: double;
CSm: Integer; //
CN: Integer;
Cni: byte;
Ct1, Ct2: Double;
procedure SetTf(const Value: Double); override;
procedure SetSm(const Value: Integer);
procedure SetN(const Value: Integer); override;
|
|
procedure Sett1(const Value: Double); override;
procedure Sett2(const Value: Double); override;
public
constructor Create;override;
destructor Destroy; override;
property Tf:Double read CTf write SetTf;
property Sm:Integer read CSm write SetSm;
property N:Integer read CN write SetN;
property t1:Double read Ct1 write Sett1;
property t2:Double read Ct2 write Sett2;
function a(Tf,t1,t2,ti:Double; Sm, N:Integer; ni:byte):Double; //
function v(Tf,t1,t2,ti:Double; Sm, N:Integer; ni:byte):Double; //
function s(Tf,t1,t2,ti:Double; Sm, N:Integer; ni:byte):Double; //
end;
TLawB5 = class(TLaw_Common)
CTf: Double;
Cti: double;
CSm: Integer; //
CN: Integer;
Cni: byte;
procedure SetTf(const Value: Double); override;
procedure SetSm(const Value: Integer);
procedure SetN(const Value: Integer); override;
public
constructor Create;override;
destructor Destroy; override;
property Tf:Double read CTf write SetTf;
property Sm:Integer read CSm write SetSm;
property N:Integer read CN write SetN;
function a(Tf,ti:Double; Sm, N:Integer; ni:byte):Double; //
function v(Tf,ti:Double; Sm, N:Integer; ni:byte):Double; //
function s(Tf,ti:Double; Sm, N:Integer; ni:byte):Double; //
end;
TLawC8 = class(TLaw_Common)
CTf: Double;
Cti: double;
Cmax:Double; //
Cmin:Double;//
CN:Integer;
Cni: byte;
procedure SetTf(const Value: Double); override;
procedure Setmax(const Value: Double);
procedure Setmin(const Value: Double);
procedure SetN(const Value: Integer); override;
public
constructor Create;override;
destructor Destroy; override;
property Tf:Double read CTf write SetTf;
propertymax:Double read Cmax write Setmax;
propertymin:Double read Cmin write Setmin;
property N:Integer read CN write SetN;
function e(Tf,ti,max,Cmin:Double; N:Integer; ni:byte):Double; //
function w(Tf,ti,max,Cmin:Double; N:Integer; ni:byte):Double; //
function (Tf,ti,max,Cmin:Double; N:Integer; ni:byte):Double; //
end;
TLaw_Movement = class (TObject) //-
LawA4: TLawA4;
LawB5: TLawB5;
LawC8: TLawC8;
CTf: Double;
Cti: double;
CSm: Integer;
Cmax:Double;
Cmin:Double;
CN:Integer;
Cni: byte;
Ct1, Ct2: Double;
procedure SetTf(const Value: Double);
procedure Setmax(const Value: Double);
procedure Setmin(const Value: Double);
procedure SetN(const Value: Integer);
procedure Sett1(const Value: Double);
procedure Sett2(const Value: Double);
procedure SetN(const Value: Integer); override;
public
constructor Create;
destructor Destroy;
property Tf:Double read CTf write SetTf;
propertymax:Double read Cmax write Setmax;
propertymin:Double read Cmin write Setmin;
property Sm:Integer read CSm write SetSm;
property N:Integer read CN write SetN;
property t1:Double read Ct1 write Sett1;
property t2:Double read Ct2 write Sett2;
function a(Tf,t1,t2,ti:Double; Sm, N:Integer; ni:byte):Double;
function v(Tf,t1,t2,ti:Double; Sm, N:Integer; ni:byte):Double;
function s(Tf,t1,t2,ti:Double; Sm, N:Integer; ni:byte):Double;
function e(Tf,t1,t2,ti,max,Cmin:Double; N:Integer; ni:byte):Double;
function w(Tf,t1,t2,ti,max,Cmin:Double; N:Integer; ni:byte):Double;
function (Tf,t1,t2,ti,max,Cmin:Double; N:Integer; ni:byte):Double;
end;
TMZveno = class // -
private
FX, FY: Integer; //
FColor:Word; //
FX0, FY0: Integer; //
procedure SetColor(const Value: Word);virtual; abstract;
procedure SetX(const Value: Integer); virtual; abstract;
procedure SetY(const Value: Integer); virtual; abstract;
procedure SetX0(const Value: Integer); virtual; abstract;
procedure SetY0(const Value: Integer); virtual; abstract;
public
constructor create;virtual; abstract;
destructor Destroy;virtual; abstract;
procedure Paint(Canvas:TCanvas);virtual; abstract; //
procedure Move(ax:Integer);virtual; abstract; //
property X:Integer read FX write SetX;
property Y:Integer read FY write SetY;
property X0:Integer read FX0 write SetX0;
property Y0:Integer read FY0 write SetY0;
property Color: Word read FColor write SetColor;
end;
TMOnward = class (TMZveno) //
FX, FY: Integer;
FColor: Word;
FX0, FY0: Integer;
FWidth, FHeight:Integer; //
|
|
FPostHeight: Integer; //
private
procedure SetWidth(const Value: Integer);
procedure SetHeight(const Value: Integer);
procedure SetPostHeight(const Value: Integer);
procedure SetColor(const Value: Word);override;
procedure SetX(const Value: Integer); override;
procedure SetY(const Value: Integer); override;
procedure SetX0(const Value: Integer); override;
procedure SetY0(const Value: Integer); override;
public
constructor create;override;
destructor Destroy;
procedure Paint(Canvas:TCanvas);override;
procedure Move(ax:Integer);override;
property X;
property Y;
property X0;
property Y0;
property Color;
propertyWidth: integer read FWidth write SetWidth;
property Height: integer read FHeight write SetHeight;
property PostHeight: integer read FPostHeight write SetPostHeight;
end;
TMRotate = class (TMZveno) //
FX, FY: Integer;
FColor: Word;
FX0, FY0: Integer;
FLength, FRadius: Integer; //
F0, F: Double; //
private
procedure SetLength(const Value: Integer);
procedure SetRadius(const Value: Integer);
procedure SetF0(const Value: Double);
procedure SetF(const Value: Double);
procedure SetColor(const Value: Word);override;
procedure SetX(const Value: Integer); override;
procedure SetY(const Value: Integer); override;
procedure SetX0(const Value: Integer); override;
procedure SetY0(const Value: Integer); override;
public
constructor create;override;
destructor Destroy;
procedure Paint(Canvas:TCanvas);override;
procedure Move(ax:Integer);override;
property X;
property Y;
property X0;
property Y0;
property Color;
propertyLength: integer read FLength write SetLength;
propertyRadius: integer read FRadius write SetRadius;
property0: double read F0write Set0;
property: double read Fwrite Set;
end;
TMRobot = class (TGraphicControl) //-
private
MOnwardA: TMOnward;
MOnwardB: TMOnward;
MRotateC: TMRotate;
FTimer:TTimer; //
FBitmap:TBitmap; { (TBitmapCanvas)}
FWidth, FHeight, FPostHeight: Integer;
FX, FY: Integer;
FColor: Word;
FX0, FY0: Integer;
FLength, FRadius: Integer;
F0, F: Double;
procedure SetWidth(const Value: Integer);
procedure SetHeight(const Value: Integer);
procedure SetPostHeight(const Value: Integer);
procedure SetColor(const Value: Word);
procedure SetX(const Value: Integer);
procedure SetY(const Value: Integer);
procedure SetX0(const Value: Integer);
procedure SetY0(const Value: Integer);
procedure SetLength(const Value: Integer);
procedure SetRadius(const Value: Integer);
procedure SetF0(const Value: Double);
procedure SetF(const Value: Double);
public
constructor Create(AOwner: TComponent);
destructor Destroy;
procedure Paint;
procedure Move;
procedureStart; //
procedureStop; //
property X:Integer read FX write SetX;
property Y:Integer read FY write SetY;
property X0:Integer read FX0 write SetX0;
property Y0:Integer read FY0 write SetY0;
property Color: Word read FColor write SetColor;
propertyWidth: integer read FWidth write SetWidth;
property Height: integer read FHeight write SetHeight;
property PostHeight: integer read FPostHeight write SetPostHeight;
propertyLength: integer read FLength write SetLength;
propertyRadius: integer read FRadius write SetRadius;
property0: double read F0write Set0;
property: double read Fwrite Set;
end;
implementation
{ TLawA4 }
function TLawA4.a(Tf,t1,t2,ti:Double; Sm,N: integer; ni:byte):Double;
begin
for ni:=0 to N do
ti:=Tf*ni/N;
begin
if ti<=t1 then
result:=2*Sm/(Tf*t1*(Tf-t1+t2))
else if ti>=t2 then
Result:=-2*Sm/(Tf*(Tf-t1)*(Tf-t1+t2))
else
result:=0;
end;
end;
constructor TLawA4.Create;
begin
inherited;
end;
destructor TLawA4.Destroy;
begin
inherited;
end;
function TLawA4.s(Tf,t1,t2,ti:Double; Sm,N: integer; ni:byte):Double;
begin
for ni:=1 to N do
ti:=Tf*ni/N;
begin
if ti<=t1 then
result:=2*Sm*ti/(Tf*t1*(Tf-t1+t2))
else if ti>=t2 then
Result:=-2*Sm*ti/(Tf*(Tf-t1)*(Tf-t1+t2))
else
result:=Sm/Tf;
end;
end;
procedure TLawA4.SetN(const Value: Integer);
begin
inherited;
CN:=Value;
end;
procedure TLawA4.SetSm(const Value: Integer);
begin
inherited;
CSm:=Value;
end;
procedure TLawA4.Sett1(const Value: Double);
begin
inherited;
Ct1:=Value;
end;
procedure TLawA4.Sett2(const Value: Double);
begin
inherited;
Ct2:=Value;
end;
procedure TLawA4.SetTf(const Value: Double);
begin
inherited;
CTf:=Value;
end;
function TLawA4.v(Tf,t1,t2,ti:Double; Sm,N: integer; ni:byte):Double;
begin
for ni:=1 to N do
ti:=Tf*ni/N;
begin
if ti<=t1 then
result:=2*Sm*Sqr(ti)/(Tf*t1*(Tf-t1+t2))
else if ti>=t2 then
Result:=-2*Sm*Sqr(ti)/(Tf*(Tf-t1)*(Tf-t1+t2))
else
result:=Sm*(ti/Tf);
end;
end;
{ TLawB5 }
function TLawB5.a(Tf,ti:Double; Sm,N: integer; ni:byte):Double;
begin
for ni:=0 to N do
ti:=Tf*ni/N;
result:=(Sm/Tf^2) * (0,5*π^2)*cos(π*ti/Tf);
end;
constructor TLawB5.Create;
begin
inherited;
end;
destructor TLawB5.Destroy;
begin
inherited;
end;
function TLawB5.s(Tf,ti:Double; Sm,N: integer; ni:byte):Double;
begin
for ni:=1 to N do
ti:=Tf*ni/N;
result:=Sm * 0,5*(1 cos(π*ti/Tf));
end;
procedure TLawB5.SetN(const Value: Integer);
begin
inherited;
CN:=Value;
end;
procedure TLawB5.SetSm(const Value: Integer);
begin
inherited;
CSm:=Value;
end;
procedure TLawB5.SetTf(const Value: Double);
begin
inherited;
CTf:=Value;
end;
function TLawB5.v(Tf,ti:Double; Sm,N: integer; ni:byte):Double;
begin
for ni:=1 to N do
ti:=Tf*ni/N;
result:=(Sm/Tf) * (0,5*π)*sin(π*ti/Tf);
end;
{ TLawC8 }
function TLawC8.e(Tf,ti,max,min:Double; N: integer; ni:byte):Double;
begin
for ni:=0 to N do
ti:=Tf*ni/N;
result:=(max/Tf^2) * 6(1-(ti/Tf));
end;
constructor TLawC8.Create;
begin
inherited;
end;
destructor TLawC8.Destroy;
begin
inherited;
end;
function TLawC8.(Tf,ti,max,min:Double; N: integer; ni:byte):Double;
begin
for ni:=1 to N do
ti:=Tf*ni/N;
result:=max * 0,5*(1 cos(π*ti/Tf));
end;
procedure TLawC8.SetN(const Value: Integer);
begin
inherited;
CN:=Value;
end;
procedure TLawC8.Setmax(const Value: Double);
begin
inherited;
CSm:=Value;
end;
procedure TLawC8.Setmin(const Value: Double);
begin
inherited;
CSm:=Value;
end;
procedure TLawC8.SetTf(const Value: Double);
begin
inherited;
CTf:=Value;
end;
function TLawC8.w(Tf,ti,max,min:Double; N: integer; ni:byte):Double;
begin
for ni:=1 to N do
ti:=Tf*ni/N;
result:=(max/Tf) * [6ti*(Tf-ti)]/Tf;
end;
{ TLaw_Movement }
constructor TLaw_Movement.Create;
begin
LawA4.Create;
LawB5.Create;
LawC8.Create;
end;
destructor TLaw_Movement.Destroy;
begin
LawA4.Destroy;
LawA4.Free;
LawB5.Destroy;
LawB5.Free;
LawC8.Destroy;
LawC8.Free;
inherited;
end;
{ TMOnwardA }
constructor TMOnwardA.create;
begin
end;
procedure TMOnwardA.Paint(Canvas:TCanvas);
inherited;
var
Rec: TRect;
with Form1.pnl1.Canvas do
begin
Canvas.Pen.Color:= clYellow;
Canvas.Brush.Color:= clBlack;
Rec:=Rect(X,Y,X+FLength,Y+FHeight);
Canvas.Rectangle(Rec);
Canvas.Pen.Width:=2;
Canvas.MoveTo(X+Length div 4, Y);
Canvas.LineTo(X+Length div 2, Y-FPostHeight);
end;
end;
procedure TMOnwardA.SetWidth(const Value: Integer);
begin
FWidth:= Value;
end;
procedure TMOnwardA.SetHeight(const Value: Integer);
begin
FHeight:= Value;
end;
destructor TMOnwardA.Destroy;
begin
inherited;
end;
procedure TMOnwardA.Move(ax: Integer);
begin
inherited;
FX:=FX0+round(TLawA4.s(Tf,t1,t2,Sm,N));
end;
procedure TMOnwardA.SetColor(const Value: Word);
begin
inherited;
FColor:= Value;
end;
procedure TMOnwardA.SetPostHeight(const Value: Integer);
begin
FPostHeight:=Value;
end;
procedure TMOnwardA.SetX(const Value: Integer);
begin
inherited;
FX:=Value;
end;
procedure TMOnwardA.SetX0(const Value: Integer);
begin
inherited;
FX0:=Value;
end;
procedure TMOnwardA.SetY(const Value: Integer);
begin
inherited;
FY:=Value;
end;
procedure TMOnwardA.SetY0(const Value: Integer);
begin
inherited;
FY0:=Value;
end;
{ TMOnwardA }
constructor TMOnwardB.create;
begin
end;
procedure TMOnwardB.Paint(Canvas:TCanvas);
inherited;
var
Rec: TRect;
with Form1.pnl1.Canvas do
begin
Canvas.Pen.Color:= clYellow;
Canvas.Brush.Color:= clBlack;
Rec:=Rect(X,Y,X+FWidth,Y+FHeight);
Canvas.Rectangle(Rec);
Canvas.Pen.Width:=2;
Canvas.MoveTo(X+Width div 4, Y);
Canvas.LineTo(X+Width div 2, Y-FPostHeight);
end;
end;
procedure TMOnwardB.SetWidth(const Value: Integer);
begin
FWidth:= Value;
end;
procedure TMOnwardB.SetHeight(const Value: Integer);
begin
FHeight:= Value;
end;
destructor TMOnwardB.Destroy;
begin
inherited;
end;
procedure TMOnwardB.Move(ax: Integer);
begin
inherited;
FX:=TMOnwardA.FX;
FY:=FY0 + round(TLawB5.s(Tf,N,Sm));
end;
procedure TMOnwardB.SetColor(const Value: Word);
begin
inherited;
FColor:= Value;
end;
procedure TMOnwardB.SetPostHeight(const Value: Integer);
begin
FPostHeight:=Value;
end;
procedure TMOnwardB.SetX(const Value: Integer);
begin
inherited;
FX:=Value;
end;
procedure TMOnwardB.SetX0(const Value: Integer);
begin
inherited;
FX0:=Value;
end;
procedure TMOnwardB.SetY(const Value: Integer);
begin
inherited;
FY:=Value;
end;
procedure TMOnwardB.SetY0(const Value: Integer);
begin
inherited;
FY0:=Value;
end;
{ TMOnwardA }
constructor TMRotateC.create;
begin
end;
procedure TMRotateC.Paint(Canvas:TCanvas);
inherited;
var
Rec: TRect;
with Form1.pnl1.Canvas do
begin
Canvas.Pen.Color:= clYellow;
Canvas.Brush.Color:= clBlack;
Rec:=Rect(X,Y,X+FLength,Y+FHeight);
Canvas.Rectangle(Rec);
Canvas.Pen.Width:=2;
Canvas.MoveTo(X+Length div 4, Y);
Canvas.LineTo(X+Length div 2, Y-FPostHeight);
end;
end;
procedure TMOnwardA.SetLength(const Value: Integer);
begin
FLength:= Value;
end;
procedure TMRotateC.SetRadius(const Value: Integer);
begin
FRadius:= Value;
end;
destructor TMRotateC.Destroy;
begin
inherited;
end;
procedure TMRotateC.Move(ax: Integer);
begin
inherited;
FX:=FX0+round(TLawA4.s(Tf,t1,t2,Sm,N));
end;
procedure TMRotateC.SetColor(const Value: Word);
begin
inherited;
FColor:= Value;
end;
procedure TMRotateC.SetX(const Value: Integer);
begin
inherited;
FX:=Value;
end;
procedure TMRotateC.SetX0(const Value: Integer);
begin
inherited;
FX0:=Value;
end;
procedure TMRotateC.SetY(const Value: Integer);
begin
inherited;
FY:=Value;
end;
procedure TMRotateC.SetY0(const Value: Integer);
begin
inherited;
FY0:=Value;
end;
{ TMRobot }
constructor TMRobot.Create;
begin
MOnwardA.Create;
MOnwardB.Create;
MRotateC.Create;
end;
destructor TMRobot.destroy;
begin
MOnwardA.Free;
MOnwardA.Destroy;
MOnwardB.Destroy;
MOnwardB.Free;
MRotateC.Destroy;
MRotateC.Free;
inherited;
end;
procedure TMRobot.Move;
begin
if Time=Tf then back:= True;
if Time=0 then back:= False;
MOnwardA.X:= Round(TLawA4.s(Tf,t1,t2,Sm,N));
MOnwardB.X:=MOnwardA.X;
MOnwardB.Y:=Round(TLawB5.s(Tf,Sm,N));
Show;
end;
procedure TMRobot.Paint;
begin
MOnwardA.Paint(Canvas);
MOnwardB.Paint(Canvas);
MRotateC.Paint(Canvas);
end;
end.//
libraryProject; // ,
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
SysUtils,
Classes,
Logo in 'Logo.pas';
Prog in Prog.pas;
Dev in Dev.pas;
exports ShowLogo index 11;
exports ShowProg index 12;
exports ShowDev index 13;
{$R *.res}
begin
end.
unitLogo; //
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, jpeg;
type
TLogo = class(TForm)
img1: TImage;
tmr1: TTimer;
procedure tmr1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Logo: TLogo;
procedure ShowLogo(Handle:THandle);export;stdcall;
implementation
{$R *.dfm}
procedure ShowLogo(Handle:THandle);
begin
Application.Handle:= Handle;
Logo:= TLogo.Create(Application);
Logo.ShowModal;
Logo.Free;
end;
procedure TLogo.tmr1Timer(Sender: TObject);
begin
tmr1.Enabled:= False;
tmr1.Free;
img1.Free;
Close;
end;
end.//
unitProg; //
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, jpeg;
type
TProg = class(TForm)
img1: TImage;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Prog: TProg;
procedure ShowProg;export;stdcall;
implementation
{$R *.dfm}
procedure ShowProg;
begin
Prog:= TProg.Create(Application);
Prog.ShowModal;
Prog.Free;
end;
end.//
unitDev; //
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, jpeg;
type
TDev = class(TForm)
img1: TImage;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Dev: TDev;
procedure ShowDev;export;stdcall;
implementation
{$R *.dfm}
procedure ShowDev;
begin
Dev:= TDev.Create(Application);
Dev.ShowModal;
Dev.Free;
end;
end.//
.
, , . , , .
.
1. ., .. - , 316 c., . . .. , 2001 .
2. http://www.oop-stud.ru/
3. . . Lazarus, 772 c., 2010.
4. . . Delphi 7 , 448 ., -, , 2003 .