var i, j: integer;
begin
setlength(Amatrix, x,y)
for i := 0 to x - 1 do
for j := 0 to y - 1 do
Amatrix[x, y] := 0;
end;
Identity : array [1..5, 1..5] of Real =
(( 0, 0, 0 , 0 , 0 ) ,
( 0 , 0, 0 , 0 , 0 ) ,
( 0, 0, 1 , 0 , 0 ) ,
( 0 , 0, 0 , 0 , 0 ) ,
( 0 , 0, 0 , 0 , 0 ) );
type 2DMatrix_REAL = array of array of Real;
var i, j: integer;
begin
setlength(Amatrix, x,y)
for i := 0 to x - 1 do
for j := 0 to y - 1 do
Amatrix[x, y] := 0;
end;
TFilter3D = array [1..3,1..3] of Real;
TFilter4D = array [1..4,1..4] of Real;
TFilter5D = array [1..5,1..5] of Real;
TFilter6D = array [1..6,1..6] of Real;
TFilter7D = array [1..7,1..7] of Real;
const SampleFiler : TFilter3D =
(( 0 , 0.2 , 0 ) ,
( 0.2, 0.2, 0.2 ) ,
( 0 , 0.2 , 0 ));
// copy static array to dyn. array dim =6
procedure LoadDynArrayFromStaticArray ( aFilter : TImageFilterReal; Dim : Integer; aStaticArray : TFilter6D ); overload;
var i,j : Integer;
begin
setlength(AFilter, dim,dim);
for i := 0 to dim -1 do
for j := 0 to dim-1 do
aFilter[i,j] := aStaticArray[i+1,j+1];
end;
// copy static array to dyn. array dim =5
procedure LoadDynArrayFromStaticArray ( aFilter : TImageFilterReal; Dim : Integer; aStaticArray : TFilter5D ); overload;
var i,j : Integer;
begin
setlength(AFilter, dim,dim);
for i := 0 to dim -1 do
for j := 0 to dim-1 do
aFilter[i,j] := aStaticArray[i+1,j+1];
end;
// copy static array to dyn. array dim =4
procedure LoadDynArrayFromStaticArray ( aFilter : TImageFilterReal; Dim : Integer; aStaticArray : TFilter4D ); overload;
var i,j : Integer;
begin
setlength(AFilter, dim,dim);
for i := 0 to dim -1 do
for j := 0 to dim-1 do
aFilter[i,j] := aStaticArray[i+1,j+1];
end;
// copy static array to dyn. array dim =3
procedure LoadDynArrayFromStaticArray ( aFilter : TImageFilterReal; Dim : Integer; aStaticArray : TFilter3D ); overload;
var i,j : Integer;
begin
setlength(AFilter, dim,dim);
for i := 0 to dim -1 do
for j := 0 to dim-1 do
aFilter[i,j] := aStaticArray[i+1,j+1];
end;
procedure LoadImageFilterByIndex( aFilterNameIndex : integer; var aFilter : TImageFilterReal);
var i ,j : Integer;
begin
case aFilterNameIndex of
0: LoadDynArrayFromStaticArray ( aFilter, 3 , BasicBlur );
1: begin
end;
2: begin
end;
3: begin
end;
else
end;
end;
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
T2dMatrix_REAL = array[1..5, 1..5] of real;
T2DMatrix_Rec = record
Description: string;
Matrix: T2DMatrix_REAL;
end;
TMatrices = array of T2dMatrix_Rec;
const
Identity : T2dMatrix_REAL =
(( 1, 2, 3 , 4 , 5 ) ,
( 6 , 7, 8 , 0 , 10 ) ,
( 11, 12, 13, 14 , 15 ) ,
( 0 , 0, 0 , 0 , 0 ) ,
( 0 , 0, 0 , 0 , 0 ) );
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
Matrices: TMatrices;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var c: char;
i: integer;
begin
SetLength(Matrices, 10);
for c:= 'A' to 'J' do
begin
i:= Ord(c) - Ord('A');
Matrices[i].Description:= c+c+c+c+c;
move(identity[1,1], matrices[i].Matrix[1,1], SizeOf(T2dMatrix_REAL));
end;
if (Matrices[1].Matrix[1,1] = 0) then;
end;
end.
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
How to programmatically differentiate between C and Java | 10 | 188 | |
Internet Explorer View Settings Question | 15 | 105 | |
oracle global variables | 4 | 63 | |
tidtcpserver connection lost handle | 2 | 69 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
20 Experts available now in Live!