-
Notifications
You must be signed in to change notification settings - Fork 0
/
coord.adb
40 lines (37 loc) · 979 Bytes
/
coord.adb
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
package body Coord is
function Dir_To_Point
(Dir : Valid_Direction;
Pos : Coord)
return Coord
is
begin
case Dir is
when U =>
return Coord'
(X => Pos.X + 1,
Y => Pos.Y);
when D =>
return Coord'
(X => Pos.X - 1,
Y => Pos.Y);
when L =>
return Coord'
(X => Pos.X,
Y => Pos.Y - 1);
when R =>
return Coord'
(X => Pos.X,
Y => Pos.Y + 1);
end case;
end Dir_To_Point;
procedure Expand_Vec (Vec : in Vector;
Wire : in out Coord_Points.Vector;
Pos : in out Coord)
is
begin
for I in Positive range 1 .. Vec.Size loop
Pos := Dir_To_Point(Vec.Direction, Pos);
Coord_Points.Append(Wire, Pos);
end loop;
end Expand_Vec;
end Coord;