agpl_1.0.0_b5da3320/src/agpl-gdk/agpl-gdk.ads

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
with Ada.Numerics.Real_Arrays; use Ada.Numerics;

package Agpl.Gdk is

   pragma Preelaborate;

   Log_Section : constant String := "agpl.gdk";

   subtype Float_Matrix is Real_Arrays.Real_Matrix (1 .. 3, 1 .. 3);

   subtype Float_Vector is Real_Arrays.Real_Vector (1 .. 3);

   Identity : constant Float_Matrix :=
                ((1.0, 0.0, 0.0),
                 (0.0, 1.0, 0.0),
                 (0.0, 0.0, 1.0));
   Look_Up  : constant Float_Matrix :=
                ((0.0, -1.0, 0.0),
                 (1.0, 0.0, 0.0),
                 (0.0, 0.0, 1.0));
   --  To get easily a "from-behind" looking transform for things aligned
   --  along the X axis.

   function "*" (M : Float_Matrix; V : Float_Vector) return Float_Vector;
   pragma Inline ("*");
   --  Dot product

   function "**" (L, R : Float_Vector) return Float_Vector;
   pragma Inline ("**");
   --  Cross product

   function H (X : Float_Vector) return Float_Vector;
   --  Homogeneization (i.e. X (3) = 1.0).

   function Inverse (X : Float_Matrix) return Float_Matrix
     renames Real_Arrays.Inverse;

   --  Debug...
   procedure Print (X : Float_Matrix);

end Agpl.Gdk;