## 3 Proposed Mechanism
### Quadrant Model for Grid Pattern Generation from the Body Movement
#### 3.2.2 Grid Neuron Activation  
Generating a hexagonal grid like activation pattern needs to know the geometry of a hexagon which is shown below in Figure 9. In the figure, the distance between any two grid points sharing the same edge is of the same length, which is the grid spacing of a hexagon. There are two or more other parameters that describe the hexagon, which is the height and the width, whose calculations are shown in Equations (4) and (5). Parameters of the equations are illustrated in Figure 9.  
Height of a hexagon:  
\[\text{H}=2\times\text{d} \tag{4}\]  
Width of a hexagon:  
\[\text{W}=\text{Sqrt}\left(3\right)\times\text{d} \tag{5}\]  
where H is the height, W is the width, and d is the grid spacing of a hexagon. Each grid point is having a specific relation with all other grid points of the grid pattern. If we consider any of the grid points as a reference point and measures the distance of all other grid points along the \(x\) and \(y\)-axis direction from the reference point, then we obtain two categories of grid points. First are those whose distance along the \(x\)-axis is the integer multiple of the width of the hexagon, and distance along the \(y\)-axis is the 0.5 multiple of the height. Second, are those whose distance along the \(x\)-axis is the (odd number/2) multiple of width and distance along the \(y\)-axis is the (odd number/4) multiple of height. In case the agent's measured distance from the reference point follows any one of the above categories of the grid points, then it shows that the agent is at one of the grid points and as a result of this the grid neuron will be fired or activated with the activation value of 1. There can be a possibility that the agent lies within the grid ring of a grid point instead of a grid point. In that case, the grid neuron will be activated but the activation would be less than one and will be inversely proportional to the distance from the center of the grid ring which equals (1-D/R) where D is the distance from the grid point under whose firing range the agent is present, and R is the radius of the firing range. The value for the activation will be zero when the distance D is larger than R.  
Since the grid points are infinite in a 2D space, therefore we need a mechanism that selects only a few grid points, to check whether the agent is within the vicinity of the grid point or not. As we know the relation of the grid points, therefore, it is easier to choose the grid points. Here, two sets of grid points can be chosen. First are those grid points whose X coordinate (XCORD)is equal to the (\(\text{W}\times\text{ROUND}\) (\(\text{A}^{\text{x}}\)/\(\text{W}\))) and Y coordinate (YCORD) lie in the range from (\(\text{H}\times\text{(CEIL}\) (\(\text{A}^{\text{y}}\)/\(\text{H})-1\))) to (\(\text{H}\times\text{(CEIL}\)(\(\text{A}^{\text{y}}\)/\(\text{H}\))). The \(\text{A}^{\text{x}}\) and the \(\text{A}^{\text{y}}\) are the coordinates of the agent along the \(x\) and \(y\)-axis, respectively. The CEIL is a function that returns the smallest integer value that  
Figure 9: The geometry of hexagonal grid points. is bigger than or equal to a number, and ROUND is the round-off function that rounds off the value to the nearest integer. Second are those in which \(x\)-axis coordinate of the grid point lies into the range from (ROUND (A\({}^{\text{x}}\)/W) \(-\) 0.5) to (ROUND (A\({}^{\text{x}}\)/W) \(+\) 0.5), and the \(y\)-axis coordinate would lie into the range of (FLOOR (A\({}^{\text{y}}\)/H) \(+\) 0.25) to (FLOOR (A\({}^{\text{y}}\)/H) \(+\) 0.75). Here, FLOOR is the largest integer function that returns the greatest integer less than or equal to a given number. The whole pseudo code to calculate the activation of a grid neuron is given below.