**Code 3.**

IF ((*<sup>r</sup>*1 − *x*√3/3 − *y*) ≤ 0) AND ((*<sup>r</sup>*2 − *x*√3/3 − *y*) ≥ 0) THEN "Area A is involved" ELSE "Area B is involved"

The *y-axis* intercept with Line 1, *r*1, in area AB, is computed by computing any point (*<sup>x</sup>*, *y*) on Line 1. Therefore, the point at the bottom-right corner of rectangle AB is computed for this purpose (see the red point in Figure 10). Hence, Equation (5) is used to find the value of *r*1. In Equation (5), we used the modulus (mod) as a function naturally extended to real numbers, i.e., it gives the remainder after the division by a real number (and that is between 0 and the divisor). Moreover, by adding 1 to *r*1, we ge<sup>t</sup> the value of the *y-axis* intercept with Line 2, *r*2 (see Code 3).

$$r\_1 = y - \left( y \bmod \frac{3}{2} \right) + \frac{\sqrt{3}}{3} \cdot \left( \mathbf{x} + \frac{\sqrt{3}}{2} - \left( \mathbf{x} \bmod \frac{\sqrt{3}}{2} \right) \right) \tag{5}$$

Similar strategies are used when the CB rectangle is involved, taking care that the slopes of Line 1 and Line 2 will be equal to <sup>√</sup>3/3.

Lastly, when the involved area A, B, or C is specified, particular formulae are used that are specified in Table 1. Example 3 is used for a further explanation.

**Figure 10.** The red point is used to compute the value of *r*1, which is the *Y*-axis intercept with Line 1.

**Example 3.** *Consider a point with Cartesian coordinates: (x, y) = (1.299, 0.45). In order to convert this Cartesian coordinate pair to its corresponding triangular triplet, the three steps below will be followed.*


*Thus, formulae of area A (see Table 1) should be applied in this order, so:*


*The corresponding triplet is (i, j, k)* ≈ *(1,* −*0.2,* −*0.5), which is approximately the same as in Example 2, as it should be.*

To show the conversion of points on other areas (e.g., Area B or Area C), the following examples are given:

#### **Example 4.** *(Point in Area B)*

*(a) Converting from Continuous Coordinate System to CCS.*

*Let (i, j, k) = (0.683, 0,* −*0.183) be a point in the triangular plane. To convert to CCS, Equation (2) is used:*

$$
\begin{pmatrix}
\frac{\sqrt{3}}{2} & 0 & -\frac{\sqrt{3}}{2} \\
\frac{1}{2} & -1 & \frac{1}{2}
\end{pmatrix}
\cdot
\begin{pmatrix}
0.683 \\
0 \\
\end{pmatrix}
\approx \begin{pmatrix}
0.75 \\
0.25
\end{pmatrix}
$$

*(b) Converting from CCS to a Continuous Coordinate System.*

*Let (x, y) = (0.75, 0.25). The corresponding Continuous Coordinate System triplet can be calculated based on the three steps above as follows.*


*Thus, formulae of area B from Table 1 are applied in the following order:*

*(1) j* = −2*y* 3 *= 0*


*The corresponding triplet is (i, j, k) = (0.683, 0,* −*0.183), which is exactly the original value.*

**Example 5.** *(Point in Area C)*

*(a) Converting from the Continuous Coordinate System to CCS.*

*Let (i, j, k) = (0.346,* −*0.626, 0) be a point in the triangular plane. To convert to CCS, we use Equation (2) below.*

$$
\begin{pmatrix}
\frac{\sqrt{3}}{2} & 0 & -\frac{\sqrt{3}}{2} \\
\frac{1}{2} & -1 & \frac{1}{2}
\end{pmatrix}
\cdot
\begin{pmatrix}
0.346 \\
0
\end{pmatrix}
\approx \begin{pmatrix}
0.299 \\
0.799
\end{pmatrix}
$$

#### *(b) Converting from CCS to a Continuous Coordinate System*

*Let (x, y) = (0.299, 0.799). The corresponding Continuous Coordinate System triplet can be calculated based on the three steps below.*


*Thus, formulae of area C from Table 1 are applied in the following order.*

$$(1) \quad k = \langle \frac{y}{3} \rangle - \langle \frac{x}{\sqrt{3}} \rangle = 0 - 0 = 0$$

$$(2) \quad i = \frac{2x}{\sqrt{3}} + k \approx \stackrel{\frown}{0.346} + 0 = 0.346$$

*(3) j = i*+*k* 2 − *y* ≈ *0.173* − *0.799 =* −*0.626*

> *The corresponding triplet is (i, j, k) = (0.346,* −*0.626, 0), which is exactly the original triplet.*

**Example 6.** *(A mid-point)*

*(a) Converting from Continuous Coordinate System to CCS.*

*Let (i, j, k) = (1, 0, 0) be a point in the triangular plane. To convert to CCS, Equation (2) is used below.*

$$
\begin{pmatrix}
\frac{\sqrt{3}}{2} & 0 & -\frac{\sqrt{3}}{2} \\
\frac{1}{2} & -1 & \frac{1}{2}
\end{pmatrix}
\cdot
\begin{pmatrix}
1 \\ 0 \\ 0
\end{pmatrix} = 
\begin{pmatrix}
\frac{\sqrt{3}}{2} \\
\frac{1}{2}
\end{pmatrix}
$$

*(b) Converting from CCS to a Continuous Coordinate System.*

*Let (x, y) = (* √3/2*, 0.5). The corresponding Continuous Coordinate System triplet can be calculated based on the three steps below.*


*Thus, formulae of area B from Table 1 are applied in the following order.*


*The corresponding triplet is (i, j, k) = (1, 0, 0), which is exactly the original value.*

#### **4. Properties of the Continuous Triangular Coordinate System**

In this section, we will focus on the most important properties of this continuous coordinate system.

#### *4.1. On the Triplets of a General Point*

In Figure 6a, consider the red straight line between *a*(+) and *a*(−), in the green area. Then, the sum of the coordinate values of the points on this line would change continuously from 1 until −1. Depending on the sum, we can classify the points as follows:

If a point with 3 CV's sum is:


**Theorem 1.** *The sum of the coordinate triplet of any point in the plane is in the range of the closed interval* [−1, 1].

**Proof.** Consider an area A of a positive triangle with the corners *a* = (*<sup>a</sup>*1, *a*2, *a*3), *b* = (*b*1, *b*2, *b*3), and *c* = (*<sup>c</sup>*1, *c*2, *c*3), where *b* and *c* are vertices (corners of an equilateral triangle) of the grid, while *a* is the midpoint of a positive triangle and *p* = (*p*1, *p*2, *p*3) is a randomly chosen point belonging to this area (inside or on the border of A). Now based on the barycentric Equation (1), we have the following.

$$\sum\_{i=1}^{3} p\_i = \sum\_{i=1}^{3} a\_i + \upsilon \cdot \left(\sum\_{i=1}^{3} (c\_i - a\_i)\right) + \mu \cdot \left(\sum\_{i=1}^{3} (b\_i - a\_i)\right)$$

It is clear that ∑3 *i*=1 *ai* = 1, whereas

$$\begin{array}{rcl} \sum\_{i=1}^{3} (c\_i - a\_i) &= (c\_1 - a\_1) + (c\_2 - a\_2) + (c\_3 - a\_3) \\ &= (c\_1 + c\_2 + c\_3) - (a\_1 + a\_2 + a\_3) \\ &= 0 - 1 = -1 \end{array}$$

Similarly, ∑3 *<sup>i</sup>*=<sup>1</sup>(*bi* − *ai*) = −1.

Then, by substitution, we have the following.

$$\sum\_{i=1}^{3} p\_i = 1 - \mu - \upsilon = 1 - (\mu + \upsilon). \tag{6}$$

Since 0 ≤ *u* + *v* ≤ 2, the maximal and minimal value of the sum of any coordinate triplet is equal to 1 (when *u* + *v =* 0) and to −1 (when *u* + *v =* 2), respectively. -

**Theorem 2.** *The sum of the coordinates of a triplet is non-negative in a positive triangle and non-positive in a negative triangle.*

**Proof.** Consider a point *p* that belongs to a positive triangle. Clearly, the coordinates of *p* are based on *u* and *v* such that 0 ≤ *u* + *v* ≤ 1. Now, by substituting *u* + *v* in Formula (6) (at the proof of Theorem 1, the summation will always be non-negative (moreover, it is positive inside the triangle).

Similarly, let *p* belong to a negative triangle, then 1 < *u* + *v* ≤ 2. Thus, by substituting into Formula (6), the sum will always be a non-positive value. -

Every point in the triangular plane has at least one integer value in its triplet. Moreover, the place of the integer value indicates its area (A, B, or C).

**Theorem 3.** *The* first *coordinate value of every point in area* A *is the same as the* first *coordinate value of the midpoint. The* second *coordinate value of every point in area* B *equals the* second *coordinate value of the midpoint. Similarly, the third coordinate value of any point in area* C *equals the third coordinate value of the midpoint* (Figure 11).

**Figure 11.** The corresponding constant coordinate value for each area.

**Proof.** Consider an area A of a positive triangle with the corners *a* = (*<sup>a</sup>*1, *a*2, *a*3), *b* = (*b*1, *b*2, *b*3), and *c* = (*<sup>c</sup>*1, *c*2, *c*3), where *b* and *c* are vertices (corners of an equilateral triangle) of the grid, while *a* is the midpoint and *p* = (*p*1, *p*2, *p*3) is a randomly chosen point belonging to this area (i.e., inside or on the border of the triangle *abc*). Since it is area A, we have *a*1 = *b*1 = *c*1. Substituting this into Equation (1), *p*1 = *a*1 follows for any point *p* in this area. A similar proof can be considered for areas B and C. -

If a triplet contains two integer values, then the point is located on the line bordering the areas. For example, a triplet of the form (1, 0, *k*) addresses a point on the line (side of the obtuse-angled triangle) between area A and B (0 ≤ *k* ≤ −1). However, if three integers are a triplet, then this triplet addresses either a midpoint or a vertex (corner) of a triangle.

#### *4.2. Relation to Discrete Coordinate Systems*


In Reference [16], the hexagonal grid is called a one-plane triangular grid since it is a sub-plane of Z<sup>3</sup> and because of its symmetry. The triangular grid (nodes of the hexagonal grid) is called a two-plane triangular grid. Combining one-plane and two-plane grids produces the so-called three-plane triangular grid, which is known as the tri-hexagonal grid (Reference [24], Figure 2). In this subsection, their coordinate systems are compared to the new coordinate system.

**Theorem 4.** *The triplets containing only integers such that their sum equals* zero *represent exactly the hexagonal grid (one-plane triangular grid).*

**Proof.** See Figure 1b for the points of this grid. One may check that exactly those points are addressed with zero-sum integer triplets for which the Cartesian coordinate pair is described below.

$$\mathbf{H} = \left\{ (\mathbf{x}, \, y) \Big| \mathbf{x} = \left( m\sqrt{3} \right) / 2, \, y = 1.5n, \text{ where } m, n \text{ are integers such that } m + n \text{ is even} \right\}.$$

**Theorem 5.** *The triplets containing only integers such that their sum is either* 0 *or* 1 *represent exactly the triangular grid (two-plane triangular grid).*

**Proof.** See Figure 1d for the points of this grid. The locations of the points with zero-sum coordinate triplets are already known by Theorem 4. Now, we give the locations of the points addressed with 1-sum (integer) triplets.

$$\mathbf{T} = \left\{ (\mathbf{x}, \, y) \Big| \mathbf{x} = \left( m\sqrt{3} \right) / 2, \, y = 1.5n - 1, \text{ where } m, n \text{ are integers such that } m + n \text{ is even} \right\}.$$

One can easily see that the union of these two sets (H and T) of points gives back exactly the vertices of the hexagons of the figure, i.e., the coordinate system of the dual triangular grid. -

**Theorem 6.** *The triplets containing only integers such that their sum is either* 0 *or* ±1 *represent exactly the tri-hexagonal grid (that is the three-plane triangular grid).*

**Proof.** See Figure 3 for the points of this grid. According to Theorem 5, the locations of the zero-sum and one-sum integer coordinate triplets are already shown. We need to show the locations of the points addressed with (integer) triplets that have −1-sum. They are:

$$\mathbf{M} = \left\{ (\mathbf{x}, y) \Big| \mathbf{x} = \left( m\sqrt{3} \right) / 2, \ y = 1.5n + 1, \text{ where } m, n \text{ are integers such that } m + n \text{ is even} \right\}.$$

Actually, the points of this grid, T ∪ H ∪ M, are exactly those that were the base of the method of creating the coordinate system. -
