Add initial prototype.
This commit is contained in:
21
1-base/math/applet/test/geometry/hexagon/hexagon_test.gpr
Normal file
21
1-base/math/applet/test/geometry/hexagon/hexagon_test.gpr
Normal file
@@ -0,0 +1,21 @@
|
||||
with
|
||||
"math",
|
||||
"lace_shared";
|
||||
|
||||
|
||||
project Hexagon_Test
|
||||
is
|
||||
for Object_Dir use "build";
|
||||
for Exec_Dir use ".";
|
||||
for Main use ("launch_hexagon_test.adb");
|
||||
|
||||
package Ide renames Lace_shared.Ide;
|
||||
package Builder renames Lace_shared.Builder;
|
||||
package Compiler renames Lace_shared.Compiler;
|
||||
package Binder renames Lace_shared.Binder;
|
||||
|
||||
package Linker is
|
||||
for Default_Switches ("ada") use ("-g");
|
||||
end Linker;
|
||||
|
||||
end Hexagon_Test;
|
||||
106
1-base/math/applet/test/geometry/hexagon/launch_hexagon_test.adb
Normal file
106
1-base/math/applet/test/geometry/hexagon/launch_hexagon_test.adb
Normal file
@@ -0,0 +1,106 @@
|
||||
with
|
||||
ada.Text_IO,
|
||||
float_Math.Geometry.d2.Hexagon;
|
||||
|
||||
|
||||
procedure launch_Hexagon_Test
|
||||
is
|
||||
use float_Math.Geometry.d2;
|
||||
|
||||
procedure log (Message : in String)
|
||||
renames ada.Text_IO.put_Line;
|
||||
|
||||
Hex : constant Hexagon.item := (circumRadius => 1.0);
|
||||
begin
|
||||
log ("");
|
||||
log (Hex'Image);
|
||||
|
||||
|
||||
log ("");
|
||||
log ("");
|
||||
for i in float_Math.Geometry.d2.Hexagon.vertex_Id
|
||||
loop
|
||||
log (Hexagon.Site (Hex, i)'Image);
|
||||
end loop;
|
||||
|
||||
|
||||
log ("");
|
||||
log ("");
|
||||
log ("1x1 Grid");
|
||||
declare
|
||||
the_Grid : constant hexagon.Grid := Hexagon.to_Grid (1, 1, 1.0);
|
||||
begin
|
||||
for Row in 1 .. the_Grid.Rows
|
||||
loop
|
||||
log ("");
|
||||
|
||||
for Col in 1 .. the_Grid.Cols
|
||||
loop
|
||||
log ("[" & Row'Image & "][" & Col'Image & "] => " & Hexagon.hex_Center (the_Grid, [Row, Col])'Image);
|
||||
end loop;
|
||||
|
||||
end loop;
|
||||
end;
|
||||
|
||||
|
||||
log ("");
|
||||
log ("");
|
||||
log ("2x1 Grid");
|
||||
declare
|
||||
the_Grid : constant hexagon.Grid := Hexagon.to_Grid (2, 1, 1.0);
|
||||
begin
|
||||
for Row in 1 .. the_Grid.Rows
|
||||
loop
|
||||
log ("");
|
||||
|
||||
for Col in 1 .. the_Grid.Cols
|
||||
loop
|
||||
log ("[" & Row'Image & "][" & Col'Image & "] => " & Hexagon.hex_Center (the_Grid, [Row, Col])'Image);
|
||||
end loop;
|
||||
|
||||
end loop;
|
||||
end;
|
||||
|
||||
|
||||
log ("");
|
||||
log ("");
|
||||
log ("1x2 Grid");
|
||||
declare
|
||||
the_Grid : constant hexagon.Grid := Hexagon.to_Grid (1, 2, 1.0);
|
||||
begin
|
||||
for Row in 1 .. the_Grid.Rows
|
||||
loop
|
||||
log ("");
|
||||
|
||||
for Col in 1 .. the_Grid.Cols
|
||||
loop
|
||||
log ("[" & Row'Image & "][" & Col'Image & "] => " & Hexagon.hex_Center (the_Grid, [Row, Col])'Image);
|
||||
end loop;
|
||||
|
||||
end loop;
|
||||
end;
|
||||
|
||||
|
||||
log ("");
|
||||
log ("");
|
||||
log ("2x2 Grid");
|
||||
declare
|
||||
the_Grid : constant hexagon.Grid := Hexagon.to_Grid (2, 2, 1.0);
|
||||
begin
|
||||
for Row in 1 .. the_Grid.Rows
|
||||
loop
|
||||
log ("");
|
||||
|
||||
for Col in 1 .. the_Grid.Cols
|
||||
loop
|
||||
log ("[" & Row'Image & "][" & Col'Image & "] => " & Hexagon.hex_Center (the_Grid, [Row, Col])'Image);
|
||||
end loop;
|
||||
|
||||
end loop;
|
||||
end;
|
||||
|
||||
|
||||
log ("");
|
||||
log ("");
|
||||
log ("Done.");
|
||||
end launch_Hexagon_Test;
|
||||
Reference in New Issue
Block a user