hedgewars/uMatrix.pas
author Wolfgang Steffens <WolfgangSteff@gmail.com>
Mon, 28 May 2012 10:38:27 +0200
changeset 7138 f8248bcba8f1
child 11317 62287d4044e7
permissions -rw-r--r--
moved generic matrix code to uMatrix.pas updated shader and client logic to use a mat4 rather than ftransform or gl_ModelViewProjectionMatrix.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7138
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
     1
(*
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
     3
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
     4
 *
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
     8
 *
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    12
 * GNU General Public License for more details.
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    13
 *
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    17
 *)
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    18
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    19
{$INCLUDE "options.inc"}
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    20
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    21
unit uMatrix;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    22
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    23
interface
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    24
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    25
uses uTypes, gl;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    26
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    27
procedure MatrixLoadIdentity(out Result: TMatrix4x4f);
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    28
procedure MatrixMultiply(out Result: TMatrix4x4f; const lhs, rhs: TMatrix4x4f);
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    29
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    30
implementation
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    31
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    32
procedure MatrixLoadIdentity(out Result: TMatrix4x4f);
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    33
begin
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    34
    Result[0,0]:= 1.0; Result[1,0]:=0.0; Result[2,0]:=0.0; Result[3,0]:=0.0;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    35
    Result[0,1]:= 0.0; Result[1,1]:=1.0; Result[2,1]:=0.0; Result[3,1]:=0.0;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    36
    Result[0,2]:= 0.0; Result[1,2]:=0.0; Result[2,2]:=1.0; Result[3,2]:=0.0;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    37
    Result[0,3]:= 0.0; Result[1,3]:=0.0; Result[2,3]:=0.0; Result[3,3]:=1.0;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    38
end;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    39
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    40
procedure MatrixMultiply(out Result: TMatrix4x4f; const lhs, rhs: TMatrix4x4f);
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    41
var
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    42
    test: TMatrix4x4f;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    43
    i, j: Integer;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    44
    error: boolean;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    45
begin
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    46
    Result[0,0]:=lhs[0,0]*rhs[0,0] + lhs[1,0]*rhs[0,1] + lhs[2,0]*rhs[0,2] + lhs[3,0]*rhs[0,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    47
    Result[0,1]:=lhs[0,1]*rhs[0,0] + lhs[1,1]*rhs[0,1] + lhs[2,1]*rhs[0,2] + lhs[3,1]*rhs[0,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    48
    Result[0,2]:=lhs[0,2]*rhs[0,0] + lhs[1,2]*rhs[0,1] + lhs[2,2]*rhs[0,2] + lhs[3,2]*rhs[0,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    49
    Result[0,3]:=lhs[0,3]*rhs[0,0] + lhs[1,3]*rhs[0,1] + lhs[2,3]*rhs[0,2] + lhs[3,3]*rhs[0,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    50
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    51
    Result[1,0]:=lhs[0,0]*rhs[1,0] + lhs[1,0]*rhs[1,1] + lhs[2,0]*rhs[1,2] + lhs[3,0]*rhs[1,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    52
    Result[1,1]:=lhs[0,1]*rhs[1,0] + lhs[1,1]*rhs[1,1] + lhs[2,1]*rhs[1,2] + lhs[3,1]*rhs[1,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    53
    Result[1,2]:=lhs[0,2]*rhs[1,0] + lhs[1,2]*rhs[1,1] + lhs[2,2]*rhs[1,2] + lhs[3,2]*rhs[1,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    54
    Result[1,3]:=lhs[0,3]*rhs[1,0] + lhs[1,3]*rhs[1,1] + lhs[2,3]*rhs[1,2] + lhs[3,3]*rhs[1,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    55
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    56
    Result[2,0]:=lhs[0,0]*rhs[2,0] + lhs[1,0]*rhs[2,1] + lhs[2,0]*rhs[2,2] + lhs[3,0]*rhs[2,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    57
    Result[2,1]:=lhs[0,1]*rhs[2,0] + lhs[1,1]*rhs[2,1] + lhs[2,1]*rhs[2,2] + lhs[3,1]*rhs[2,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    58
    Result[2,2]:=lhs[0,2]*rhs[2,0] + lhs[1,2]*rhs[2,1] + lhs[2,2]*rhs[2,2] + lhs[3,2]*rhs[2,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    59
    Result[2,3]:=lhs[0,3]*rhs[2,0] + lhs[1,3]*rhs[2,1] + lhs[2,3]*rhs[2,2] + lhs[3,3]*rhs[2,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    60
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    61
    Result[3,0]:=lhs[0,0]*rhs[3,0] + lhs[1,0]*rhs[3,1] + lhs[2,0]*rhs[3,2] + lhs[3,0]*rhs[3,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    62
    Result[3,1]:=lhs[0,1]*rhs[3,0] + lhs[1,1]*rhs[3,1] + lhs[2,1]*rhs[3,2] + lhs[3,1]*rhs[3,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    63
    Result[3,2]:=lhs[0,2]*rhs[3,0] + lhs[1,2]*rhs[3,1] + lhs[2,2]*rhs[3,2] + lhs[3,2]*rhs[3,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    64
    Result[3,3]:=lhs[0,3]*rhs[3,0] + lhs[1,3]*rhs[3,1] + lhs[2,3]*rhs[3,2] + lhs[3,3]*rhs[3,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    65
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    66
{
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    67
    Result[0,0]:=lhs[0,0]*rhs[0,0] + lhs[1,0]*rhs[0,1] + lhs[2,0]*rhs[0,2] + lhs[3,0]*rhs[0,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    68
    Result[0,1]:=lhs[0,0]*rhs[1,0] + lhs[1,0]*rhs[1,1] + lhs[2,0]*rhs[1,2] + lhs[3,0]*rhs[1,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    69
    Result[0,2]:=lhs[0,0]*rhs[2,0] + lhs[1,0]*rhs[2,1] + lhs[2,0]*rhs[2,2] + lhs[3,0]*rhs[2,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    70
    Result[0,3]:=lhs[0,0]*rhs[3,0] + lhs[1,0]*rhs[3,1] + lhs[2,0]*rhs[3,2] + lhs[3,0]*rhs[3,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    71
  
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    72
    Result[1,0]:=lhs[0,1]*rhs[0,0] + lhs[1,1]*rhs[0,1] + lhs[2,1]*rhs[0,2] + lhs[3,1]*rhs[0,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    73
    Result[1,1]:=lhs[0,1]*rhs[1,0] + lhs[1,1]*rhs[1,1] + lhs[2,1]*rhs[1,2] + lhs[3,1]*rhs[1,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    74
    Result[1,2]:=lhs[0,1]*rhs[2,0] + lhs[1,1]*rhs[2,1] + lhs[2,1]*rhs[2,2] + lhs[3,1]*rhs[2,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    75
    Result[1,3]:=lhs[0,1]*rhs[3,0] + lhs[1,1]*rhs[3,1] + lhs[2,1]*rhs[3,2] + lhs[3,1]*rhs[3,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    76
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    77
    Result[2,0]:=lhs[0,2]*rhs[0,0] + lhs[1,2]*rhs[0,1] + lhs[2,2]*rhs[0,2] + lhs[3,2]*rhs[0,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    78
    Result[2,1]:=lhs[0,2]*rhs[1,0] + lhs[1,2]*rhs[1,1] + lhs[2,2]*rhs[1,2] + lhs[3,2]*rhs[1,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    79
    Result[2,2]:=lhs[0,2]*rhs[2,0] + lhs[1,2]*rhs[2,1] + lhs[2,2]*rhs[2,2] + lhs[3,2]*rhs[2,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    80
    Result[2,3]:=lhs[0,2]*rhs[3,0] + lhs[1,2]*rhs[3,1] + lhs[2,2]*rhs[3,2] + lhs[3,2]*rhs[3,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    81
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    82
    Result[3,0]:=lhs[0,3]*rhs[0,0] + lhs[1,3]*rhs[0,1] + lhs[2,3]*rhs[0,2] + lhs[3,3]*rhs[0,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    83
    Result[3,1]:=lhs[0,3]*rhs[1,0] + lhs[1,3]*rhs[1,1] + lhs[2,3]*rhs[1,2] + lhs[3,3]*rhs[1,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    84
    Result[3,2]:=lhs[0,3]*rhs[2,0] + lhs[1,3]*rhs[2,1] + lhs[2,3]*rhs[2,2] + lhs[3,3]*rhs[2,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    85
    Result[3,3]:=lhs[0,3]*rhs[3,0] + lhs[1,3]*rhs[3,1] + lhs[2,3]*rhs[3,2] + lhs[3,3]*rhs[3,3];
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    86
}
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    87
    glPushMatrix;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    88
    glLoadMatrixf(@lhs[0, 0]);
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    89
    glMultMatrixf(@rhs[0, 0]);
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    90
    glGetFloatv(GL_MODELVIEW_MATRIX, @test[0, 0]);
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    91
    glPopMatrix;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    92
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    93
    error:=false;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    94
    for i:=0 to 3 do
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    95
      for j:=0 to 3 do
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    96
        if Abs(test[i, j] - Result[i, j]) > 0.000001 then
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    97
          error:=true;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    98
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
    99
    if error then
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   100
    begin
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   101
        writeln('shall:');
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   102
        for i:=0 to 3 do
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   103
        begin
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   104
          for j:=0 to 3 do
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   105
            write(test[i, j]);
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   106
          writeln;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   107
        end;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   108
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   109
        writeln('is:');
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   110
        for i:=0 to 3 do
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   111
        begin
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   112
          for j:=0 to 3 do
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   113
            write(Result[i, j]);
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   114
          writeln;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   115
        end;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   116
        halt(0);
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   117
    end;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   118
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   119
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   120
end;
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   121
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   122
f8248bcba8f1 moved generic matrix code to uMatrix.pas
Wolfgang Steffens <WolfgangSteff@gmail.com>
parents:
diff changeset
   123
end.