Interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm3 = class(TForm)
RadioGroup1: TRadioGroup;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
TreanglA:array[1..3,1..3] of integer;
rectanglA:array[1..4,1..3] of integer;
TreanglR:array[1..3,1..3] of real;
rectanglR:array[1..4,1..3] of real;
B:array[1..3,1..3] of real;
Implementation
{$R *.dfm}
uses Unit1;
procedure TForm3.Button1Click(Sender: TObject);
var ii,jj,kk:integer;
begin
form3.Hide;
for ii:=1 to 3 do
for jj:=1 to 3 do
if ii=jj then B[ii,jj]:=1
else
B[ii,jj]:=0;
if form3.RadioGroup1.ItemIndex=0 then
begin
B[1,1]:=-1;
B[2,2]:=1;
end;
if form3.RadioGroup1.ItemIndex=1 then
begin
B[1,1]:=1;
B[2,2]:=-1;
end;
If form3.RadioGroup1.ItemIndex=2 then
begin
B[1,1]:=-1;
B[2,2]:=-1;
end;
if tr=true then
begin
for ii:=1 to 3 do
begin
TreanglA[ii,1]:=Treangl[ii,1]-xx;
TreanglA[ii,2]:=yy-Treangl[ii,2];
TreanglA[ii,3]:=1;
end;
for ii:=1 to 3 do
for kk:=1 to 3 do
begin
TreanglR[ii,kk]:=0;
for jj:=1 to 3 do
TreanglR[ii,kk]:=TreanglR[ii,kk]+TreanglA[ii,jj]*B[jj,kk];
end;
for ii:=1 to 3 do
begin
Treangl[ii,1]:=round(xx+TreanglR[ii,1]);
Treangl[ii,2]:=round(yy-TreanglR[ii,2]);
end;
form1.Image1.Canvas.MoveTo(Treangl[1,1],Treangl[1,2]);
form1.Image1.Canvas.LineTo(Treangl[2,1],Treangl[2,2]);
form1.Image1.Canvas.LineTo(Treangl[3,1],Treangl[3,2]);
form1.Image1.Canvas.LineTo(Treangl[1,1],Treangl[1,2]);
form3.RadioGroup1.ItemIndex:=-1;
end;
if rec=true then
begin
for ii:=1 to 4 do
begin
RectanglA[ii,1]:=Rectangl[ii,1]-xx;
RectanglA[ii,2]:=yy-Rectangl[ii,2];
RectanglA[ii,3]:=1;
end;
for ii:=1 to 4 do
for kk:=1 to 4 do
begin
RectanglR[ii,kk]:=0;
for jj:=1 to 4 do
RectanglR[ii,kk]:= RectanglR[ii,kk]+RectanglA[ii,jj]*B[jj,kk];
end;
for ii:=1 to 4 do
begin
Rectangl[ii,1]:=round(xx+RectanglR[ii,1]);
Rectangl[ii,2]:=round(yy-RectanglR[ii,2]);
end;
form1.Image1.Canvas.MoveTo(Rectangl[1,1],Rectangl[1,2]);
form1.Image1.Canvas.LineTo(rectangl[2,1],rectangl[2,2]);
form1.Image1.Canvas.LineTo(rectangl[3,1],rectangl[3,2]);
form1.Image1.Canvas.LineTo(rectangl[4,1],rectangl[4,2]);
form1.Image1.Canvas.LineTo(rectangl[1,1],rectangl[1,2]);
form3.RadioGroup1.ItemIndex:=-1;
end;
end;
end.
unit Unit4;
Interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm4 = class(TForm)
Button1: TButton;
Edit1: TEdit;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
TreanglA:array[1..3,1..3] of integer;
rectanglA:array[1..4,1..3] of integer;
TreanglR:array[1..3,1..3] of real;
rectanglR:array[1..4,1..3] of real;
B:array[1..3,1..3] of real;
Implementation
{$R *.dfm}
uses Unit1;
procedure TForm4.Button1Click(Sender: TObject);
var ii,jj,kk:integer;
begin
form4.Hide;
for ii:=1 to 3 do
for jj:=1 to 3 do
if ii=jj then B[ii,jj]:=1
else
B[ii,jj]:=0;
if form4.CheckBox1.Checked then
B[1,2]:=strtoint(form4.Edit1.Text);
if form4.CheckBox2.Checked then
B[2,1]:=strtoint(form4.Edit2.Text);
if form4.CheckBox1.Checked and form4.CheckBox2.Checked then
begin
B[1,2]:=strtoint(form4.Edit1.Text);
B[2,1]:=strtoint(form4.Edit2.Text);
end;
if tr=true then
begin
for ii:=1 to 3 do
begin
TreanglA[ii,1]:=Treangl[ii,1]-xx;
TreanglA[ii,2]:=yy-Treangl[ii,2];
TreanglA[ii,3]:=1;
end;
for ii:=1 to 3 do
for kk:=1 to 3 do
begin
TreanglR[ii,kk]:=0;
for jj:=1 to 3 do
TreanglR[ii,kk]:=TreanglR[ii,kk]+TreanglA[ii,jj]*B[jj,kk];
end;
for ii:=1 to 3 do
begin
Treangl[ii,1]:=round(xx+TreanglR[ii,1]);
Treangl[ii,2]:=round(yy-TreanglR[ii,2]);
end;
form1.Image1.Canvas.MoveTo(Treangl[1,1],Treangl[1,2]);
form1.Image1.Canvas.LineTo(Treangl[2,1],Treangl[2,2]);
form1.Image1.Canvas.LineTo(Treangl[3,1],Treangl[3,2]);
form1.Image1.Canvas.LineTo(Treangl[1,1],Treangl[1,2]);
form4.Edit1.Text:='';
form4.Edit2.Text:='';
form4.CheckBox1.Checked:=false;
form4.CheckBox2.Checked:=false;
end;
if rec=true then
begin
for ii:=1 to 4 do
begin
RectanglA[ii,1]:=Rectangl[ii,1]-xx;
RectanglA[ii,2]:=yy-Rectangl[ii,2];
RectanglA[ii,3]:=1;
end;
for ii:=1 to 4 do
for kk:=1 to 4 do
begin
RectanglR[ii,kk]:=0;
for jj:=1 to 4 do
RectanglR[ii,kk]:= RectanglR[ii,kk]+RectanglA[ii,jj]*B[jj,kk];
end;
for ii:=1 to 4 do
begin
Rectangl[ii,1]:=round(xx+RectanglR[ii,1]);
Rectangl[ii,2]:=round(yy-RectanglR[ii,2]);
end;
form1.Image1.Canvas.MoveTo(Rectangl[1,1],Rectangl[1,2]);
form1.Image1.Canvas.LineTo(rectangl[2,1],rectangl[2,2]);
form1.Image1.Canvas.LineTo(rectangl[3,1],rectangl[3,2]);
form1.Image1.Canvas.LineTo(rectangl[4,1],rectangl[4,2]);
form1.Image1.Canvas.LineTo(rectangl[1,1],rectangl[1,2]);
form4.Edit1.Text:='';
form4.Edit2.Text:='';
form4.CheckBox1.Checked:=false;
form4.CheckBox2.Checked:=false;
end;
end;
end.
unit Unit5;