Vector Arithmetic in the Triangular Grid

Vector arithmetic is a base of (coordinate) geometry, physics and various other disciplines. The usual method is based on Cartesian coordinate-system which fits both to continuous plane/space and digital rectangular-grids. The triangular grid is also regular, but it is not a point lattice: it is not closed under vector-addition, which gives a challenge. The points of the triangular grid are represented by zero-sum and one-sum coordinate-triplets keeping the symmetry of the grid and reflecting the orientations of the triangles. This system is expanded to the plane using restrictions like, at least one of the coordinates is an integer and the sum of the three coordinates is in the interval [−1,1]. However, the vector arithmetic is still not straightforward; by purely adding two such vectors the result may not fulfill the above conditions. On the other hand, for various applications of digital grids, e.g., in image processing, cartography and physical simulations, one needs to do vector arithmetic. In this paper, we provide formulae that give the sum, difference and scalar product of vectors of the continuous coordinate system. Our work is essential for applications, e.g., to compute discrete rotations or interpolations of images on the triangular grid.


Introduction
On the one hand, vector arithmetic, addition, subtraction and scalar product of vectors are base of analytic and coordinate geometry, physics and other disciplines. On the other hand, digital geometry, as a part of discrete mathematics, including, e.g., the geometry of the computer screen, is the scientific field of geometric properties of digital images. Basically, digital geometry deals with points addressed by integer coordinates in Euclidean space and it is considered to be its digitized model. However, there are fundamental differences between Euclidean and digital geometry, e.g., digital images are consisting of a finite set of pixels. While in Euclidean geometry there are infinitely many points between any two distinct points; in digital geometry, the concept of neighborhood plays a central role. Moreover, the underlying grid takes matter, since both the representations and properties of the images, and thus the possible operations on them, depend on the grid itself. The operations should work on sets of discrete points addressed with integer coordinates. There are three regular tessellations of the two-dimensional Euclidean space, i.e., the plane: The square, the hexagonal and the triangular grids are shown in Figure 1; their names come from the shape of the pixels used as tiles [1]. The Cartesian coordinate system fits very well to the square grid because it is an orthogonal coordinate system having axes parallel and orthogonal to the sides of the pixels. Also, in coordinate geometry, the Euclidean space is usually denoted by ℝ ; and thus, its restriction to integer-valued points gives exactly the usual representation ℤ of the square grid. The two coordinates in both cases (plane and discrete grid) are independent of each other. Since these coordinate systems are well studied and widely known, hardware industry and most of the applications are using this grid. The dual of the square grid (that is, the grid formed by the nodes, which are the crossing points of the gridlines) is also a square grid; therefore, essentially, the same coordinate system is used to address either the pixels or the nodes of the grid. The usual vector arithmetic is based on Cartesian coordinate system when the Euclidean space or the rectangular grids are used, in the latter case both the nodes/vertices of the grid and the Voronoi cells (pixels or voxels) can be addressed by Cartesian vectors. Working with digital images, we may need to perform operations that do not map the grid into itself, e.g., zooming or rotations. As we have already mentioned, the Cartesian coordinate system allows using real numbers, and intermediate computations can result those, then a digitization operation can easily be defined by rounding operation to get the final result as a digital image. On the other hand, there are several studies that show problems, paradoxes of digital geometry of the square grid, e.g., the diagonals of a usual chessboard as lines cross each other without having a common pixel (this is a well-known shortcoming, a topological paradox of the square grid and there are various sophisticated techniques to avoid it) [2]. Both of the basic digital distances on the square grid, the Manhattan taxi-cab distance (same as L1 distance) and the chessboard distance (same as L∞ distance) have very large rotational dependency. The same digital distance to the axis direction and to the direction precisely between two axes (i.e., 45°) have more than 40% difference in Euclidean distance. Therefore, in many times, it is worth to consider the other two grids also in applications to avoid some of the disadvantages of the square grid and, at the same time, gaining some of the advantages of the other grids. Some of these advantages are recalled in the next part.
The hexagonal grid, tiling the plane by same size regular hexagons (hexels or hexagonal pixels), has been used for decades in image processing applications [3], in cartography [4,5], in biological simulations [6] and in other fields, since the digital geometry of the hexagonal grid provides better results than the square grid in various cases. It is the simplest grid, in the sense that there is only one type of widely used neighborhood among the hexels, opposite to the two types of neighbors in the square grid [7]. The six neighbors of a hexel can be seen in Figure 1 in the middle. A coordinate system with zero-sum triplets can be used to describe the hexagonal grid capturing nicely the symmetry of the grid [8]. This coordinate system (see also Figure 2a) allows also real numbers to use to describe e.g., rotations that may not map the hexagonal grid to itself [9]. Moreover, a useful digitization operator is provided as well. This coordinate system appears also in [10,11] for various applications in imaging related disciplines. The Cartesian coordinate system fits very well to the square grid because it is an orthogonal coordinate system having axes parallel and orthogonal to the sides of the pixels. Also, in coordinate geometry, the Euclidean space is usually denoted by R 2 ; and thus, its restriction to integer-valued points gives exactly the usual representation Z 2 of the square grid. The two coordinates in both cases (plane and discrete grid) are independent of each other. Since these coordinate systems are well studied and widely known, hardware industry and most of the applications are using this grid. The dual of the square grid (that is, the grid formed by the nodes, which are the crossing points of the gridlines) is also a square grid; therefore, essentially, the same coordinate system is used to address either the pixels or the nodes of the grid. The usual vector arithmetic is based on Cartesian coordinate system when the Euclidean space or the rectangular grids are used, in the latter case both the nodes/vertices of the grid and the Voronoi cells (pixels or voxels) can be addressed by Cartesian vectors. Working with digital images, we may need to perform operations that do not map the grid into itself, e.g., zooming or rotations. As we have already mentioned, the Cartesian coordinate system allows using real numbers, and intermediate computations can result those, then a digitization operation can easily be defined by rounding operation to get the final result as a digital image. On the other hand, there are several studies that show problems, paradoxes of digital geometry of the square grid, e.g., the diagonals of a usual chessboard as lines cross each other without having a common pixel (this is a well-known shortcoming, a topological paradox of the square grid and there are various sophisticated techniques to avoid it) [2]. Both of the basic digital distances on the square grid, the Manhattan taxi-cab distance (same as L 1 distance) and the chessboard distance (same as L ∞ distance) have very large rotational dependency. The same digital distance to the axis direction and to the direction precisely between two axes (i.e., 45 • ) have more than 40% difference in Euclidean distance. Therefore, in many times, it is worth to consider the other two grids also in applications to avoid some of the disadvantages of the square grid and, at the same time, gaining some of the advantages of the other grids. Some of these advantages are recalled in the next part.
The hexagonal grid, tiling the plane by same size regular hexagons (hexels or hexagonal pixels), has been used for decades in image processing applications [3], in cartography [4,5], in biological simulations [6] and in other fields, since the digital geometry of the hexagonal grid provides better results than the square grid in various cases. It is the simplest grid, in the sense that there is only one type of widely used neighborhood among the hexels, opposite to the two types of neighbors in the square grid [7]. The six neighbors of a hexel can be seen in Figure 1 in the middle. A coordinate system with zero-sum triplets can be used to describe the hexagonal grid capturing nicely the symmetry of the grid [8]. This coordinate system (see also Figure 2a) allows also real numbers to use to describe e.g., rotations that may not map the hexagonal grid to itself [9]. Moreover, a useful digitization operator is provided as well. This coordinate system appears also in [10,11] for various applications in imaging related disciplines.
In contrast to the square grid, the dual of the hexagonal grid is not the hexagonal, but the triangular grid. Thus, the triangular grid has similar symmetric properties as the hexagonal grid has. Consequently, in [12][13][14] integer coordinate triplets with sum 0 and 1 are used to represent the trixels (triangle pixels). The two different sum values reflect the two different orientations of the triangle tiles. Figure 2b shows a part of the grid with the assigned triplets. Of course, the three values are not independent for the hexagonal and triangular grids, since they are also 2D grids. To work with various algorithms in computer graphics and image processing that may not map the grid into itself, one needs the continuous extension of this coordinate system as well, which was recently developed [15]. This continuous coordinate system for triangular grid (Ω) is used to describe every point of the plane with a unique coordinate triplet. Moreover, this system can be seen as an extension of the discrete coordinate systems of the hexagonal and triangular grids. However, since the vectors of the grid fulfilling some constraints (e.g., at least one of the coordinates is an integer and the sum of the three coordinates is in the closed interval [−1,1]), the vector addition (that is closely connected to translations of images [16]) and other operations with these vectors are not straightforward. This is the topic of this paper: as a continuation of our earlier paper [15], we provide a procedure to add two (or more) vectors, to subtract vectors, and to compute the scalar product of a vector (with integer coefficient) on the continuous coordinate system for the triangular grid. Although we work with continuous coordinate system which uses real numbers, our work is essential in discrete mathematics, especially, in digital geometry to work, e.g., with digital images on the triangular grid. We should also note that hexagonal, triangular, honeycomb and other related grid structures are used in various other fields, e.g., in networks [12,13,[17][18][19], in fractional calculus [20,21], in 3D printing [22], in chemical and physical modelling [23] and simulations [24,25], and in city planning [26], where continuous transformations play also crucial roles, thus our result may be applied. Additionally to the above mentioned fields, triangular grid is applied in skeletonization and thinning algorithms [27,28], in discrete tomography [29] and in cartography. The importance of the triangular grid can be underlined by the following facts. Firstly, it is the simplest in the sense that it is based on the simplest regular polygons, on triangle pixels. Then, similarly to the hexagonal grid, it has more symmetry axes than the square grid has; moreover, rotations with smaller angle (e.g., 60 • ) could map the grid into itself than the angle needed on the square grid (90 • ). However, the square and the triangle can be divided into similar, but (e.g., 4 or 9) smaller sized shapes, allowing an easy way of changing the resolution of images on these two grids; which does not go in such a simple way on the hexagonal grid. Finally, based on the three types of neighbor pixels [27], there is a wider flexibility for digital distances [14,30] to approximate better the Euclidean distance, and at the same time, to have digital distances with lower rotational dependence than on the other two regular grids. To establish the connection between continuous and discrete planes is important for engineering applications as well. The non-linearity of our system could be applied in the case of visual projections in self-driving car scenarios, such as assessing the splay angles from lateral offset and vice-versa [31] and also in the case of how humans project their memory recordings in memory coordinate spaces [32].
The structure of this paper is as follows. In the next section, as preliminaries, we recall some basic facts about transformations on the square grid and we recall the continuous coordinate system for the triangular grid (Ω) with conversions to/from the Cartesian coordinate system. The main contribution of this paper, the addition of vectors in the continuous coordinate system for the triangular grid will be investigated and described in Section 3, while other arithmetic operations and an application are given in Section 4. Concluding remarks will closes this paper in Section 5. Entropy 2021, 23, x FOR PEER REVIEW 4 of 23 (a) (b) Figure 2. (a) The discrete symmetric coordinate system for the hexagonal and (b) for the triangular grids. The coordinate values can also be considered to be assigned the midpoints of the corresponding pixels.

Preliminaries
In this section, we show, first, how vector addition is related to translations on the traditional grids, i.e., on the square grid. Then, we recall the continuous coordinate system for the triangular grid with some of its crucial properties from [15].

Vector Additions as Translations
Translation is an isometric transformation. Any point (x,y) of the plain can be translated by any vector (tx,ty)∈ ℝ resulting in the point (x + tx,y + ty)∈ ℝ . Observe here that the coordinates of the point can also be seen as a vector from the origin to the point, and thus, the translation coincides with a vector addition which is a simple algebraic operation in this case.
Isometric transformations are well known basics of Euclidean geometry. However, more and more of our world become digital, i.e., we have digital images on our computers, smartphones, etc. It is assumed and expected that isometric transformations have a similar role in discrete/digital geometry. The digitized variants of the transformations are somewhat close to their original Euclidean, continuous variants. On the other hand, they usually do not satisfy the same properties, as usually bijectivity and/or transitivity etc. could fail. In general, these properties are hard to retain in the discrete spaces [33], whenever considering a discretized form of an arbitrary Euclidean transformation. Thus, discrete and continuous transformations yield very different theories [34]. Therefore, discrete transformations are still a hot topic of research both in theory and applications.
Translations defined on ℤ , on the square grid, are simple and essential for various transformations in several applications related to 2D image processing such as image matching. Whenever the translation vector is also an integer vector (i.e., it belongs to ℤ ), again a simple vector addition gives the result. Further, any digital picture on the square grid can be translated by any vector of ℝ . However, if the translation vector is not in ℤ , the result by simple vector addition will not be in the target ℤ anymore. Thus, a so-called digitization operation is needed to be performed after the translation to ensure the result to be again a digital image. In this way, a combination of the Euclidian translation defined on ℝ with a digitization operator that maps the outcomes back into ℤ is applied. The square and the hexagonal grids are point lattices, because any of the grid-vectors is taken from any grid-point, it will always end up at a grid-point. Consequently, a similar vectoraddition technique (with a fairly simple digitization operation) works also on the hexagonal grid for computing translations [9]. The digitization process plays important roles on grids when such discretized/digital operations are considered which may not be bijective [33,35], see Figure 3.

Preliminaries
In this section, we show, first, how vector addition is related to translations on the traditional grids, i.e., on the square grid. Then, we recall the continuous coordinate system for the triangular grid with some of its crucial properties from [15].

Vector Additions as Translations
Translation is an isometric transformation. Any point (x,y) of the plain can be translated by any vector (t x ,t y )∈ R 2 resulting in the point (x + t x ,y + t y )∈ R 2 . Observe here that the coordinates of the point can also be seen as a vector from the origin to the point, and thus, the translation coincides with a vector addition which is a simple algebraic operation in this case.
Isometric transformations are well known basics of Euclidean geometry. However, more and more of our world become digital, i.e., we have digital images on our computers, smartphones, etc. It is assumed and expected that isometric transformations have a similar role in discrete/digital geometry. The digitized variants of the transformations are somewhat close to their original Euclidean, continuous variants. On the other hand, they usually do not satisfy the same properties, as usually bijectivity and/or transitivity etc. could fail. In general, these properties are hard to retain in the discrete spaces [33], whenever considering a discretized form of an arbitrary Euclidean transformation. Thus, discrete and continuous transformations yield very different theories [34]. Therefore, discrete transformations are still a hot topic of research both in theory and applications.
Translations defined on Z 2 , on the square grid, are simple and essential for various transformations in several applications related to 2D image processing such as image matching. Whenever the translation vector is also an integer vector (i.e., it belongs to Z 2 ), again a simple vector addition gives the result. Further, any digital picture on the square grid can be translated by any vector of R 2 . However, if the translation vector is not in Z 2 , the result by simple vector addition will not be in the target Z 2 anymore. Thus, a so-called digitization operation is needed to be performed after the translation to ensure the result to be again a digital image. In this way, a combination of the Euclidian translation defined on R 2 with a digitization operator that maps the outcomes back into Z 2 is applied. The square and the hexagonal grids are point lattices, because any of the grid-vectors is taken from any grid-point, it will always end up at a grid-point. Consequently, a similar vector-addition technique (with a fairly simple digitization operation) works also on the hexagonal grid for computing translations [9]. The digitization process plays important roles on grids when such discretized/digital operations are considered which may not be bijective [33,35], see Figure 3. Entropy 2021, 23, x FOR PEER REVIEW 5 of 23 Figure 3. Any grid-vector of specific length and direction will lead to a grid-point in the square and the hexagonal grids but not in the triangular grid.
Here we are working on the triangular grid, which is, in fact, not a point lattice: it is not closed under the addition of grid-vectors. This fact gives a mathematical challenge. Those specific isometric transformations of the triangular grid are described in [36,37] that map the grid into itself; but general transformations that could map some grid-points out of the grid were not considered yet in detail. Actually, with the provided features of the continuous coordinate system, one may perform these types of transformations. Consequently, as the next step towards this, we introduce a procedure of vector addition in this system, which is considered as a basis of various types of transformations, including translations. Now, we recall the used coordinate systems for the triangular grid.

Coordinate Systems for the Triangular Grid
First, very briefly we write about a discrete coordinate system that is the base of the continuous coordinate system. In [38], various discrete coordinate systems were used for a family of various triangular grids, in each of them, integer triplets were used to address the pixels of the considered grid. These coordinate systems are symmetric coordinate systems reflecting the symmetry of the grids; the three coordinate axes have angles 120°. We start with the coordinate system for the trihexagonal grid (also called 3-planes triangular grid in [38]). The midpoints of the triangles (drawn in black color) are addressed with integer triplets with sum + 1 and -1, respectively. Notice that there are two different orientations of trixels. They are called "positive"  and "negative"  triangles, respectively. See Figure 4. Observe that each triplet assigned to a midpoint (see the blue triplets) builds up from the coordinate values shared by exactly two of the corners of the given trixel (see the three red triplets around each blue triplet). . The symmetric coordinate system for the trihexagonal grid can also be used for the triangular grid and also for its dual, for the hexagonal grid, at the same time. Here we are working on the triangular grid, which is, in fact, not a point lattice: it is not closed under the addition of grid-vectors. This fact gives a mathematical challenge. Those specific isometric transformations of the triangular grid are described in [36,37] that map the grid into itself; but general transformations that could map some grid-points out of the grid were not considered yet in detail. Actually, with the provided features of the continuous coordinate system, one may perform these types of transformations. Consequently, as the next step towards this, we introduce a procedure of vector addition in this system, which is considered as a basis of various types of transformations, including translations. Now, we recall the used coordinate systems for the triangular grid.

Coordinate Systems for the Triangular Grid
First, very briefly we write about a discrete coordinate system that is the base of the continuous coordinate system. In [38], various discrete coordinate systems were used for a family of various triangular grids, in each of them, integer triplets were used to address the pixels of the considered grid. These coordinate systems are symmetric coordinate systems reflecting the symmetry of the grids; the three coordinate axes have angles 120 • . We start with the coordinate system for the trihexagonal grid (also called 3-planes triangular grid in [38]). The midpoints of the triangles (drawn in black color) are addressed with integer triplets with sum + 1 and −1, respectively. Notice that there are two different orientations of trixels. They are called "positive" and "negative" ∇ triangles, respectively. See Figure 4. Observe that each triplet assigned to a midpoint (see the blue triplets) builds up from the coordinate values shared by exactly two of the corners of the given trixel (see the three red triplets around each blue triplet).  Here we are working on the triangular grid, which is, in fact, not a point lattice: it is not closed under the addition of grid-vectors. This fact gives a mathematical challenge. Those specific isometric transformations of the triangular grid are described in [36,37] that map the grid into itself; but general transformations that could map some grid-points out of the grid were not considered yet in detail. Actually, with the provided features of the continuous coordinate system, one may perform these types of transformations. Consequently, as the next step towards this, we introduce a procedure of vector addition in this system, which is considered as a basis of various types of transformations, including translations. Now, we recall the used coordinate systems for the triangular grid.

Coordinate Systems for the Triangular Grid
First, very briefly we write about a discrete coordinate system that is the base of the continuous coordinate system. In [38], various discrete coordinate systems were used for a family of various triangular grids, in each of them, integer triplets were used to address the pixels of the considered grid. These coordinate systems are symmetric coordinate systems reflecting the symmetry of the grids; the three coordinate axes have angles 120°. We start with the coordinate system for the trihexagonal grid (also called 3-planes triangular grid in [38]). The midpoints of the triangles (drawn in black color) are addressed with integer triplets with sum + 1 and -1, respectively. Notice that there are two different orientations of trixels. They are called "positive"  and "negative"  triangles, respectively. See Figure 4. Observe that each triplet assigned to a midpoint (see the blue triplets) builds up from the coordinate values shared by exactly two of the corners of the given trixel (see the three red triplets around each blue triplet). . The symmetric coordinate system for the trihexagonal grid can also be used for the triangular grid and also for its dual, for the hexagonal grid, at the same time. . The symmetric coordinate system for the trihexagonal grid can also be used for the triangular grid and also for its dual, for the hexagonal grid, at the same time. Now we show the extension of the previous system to the whole plane [15]. The continuous coordinate system Ω uniquely addresses every point of the plane. It is a combination of discrete triangular coordinate systems using only integer values, including the one we have just mentioned, with the barycentric coordinate system by Möbius (see, e.g., [1,39]). Each trixel, i.e., equilateral triangle of the triangular grid (drawn by black lines in Figure 4) is divided into three inner obtuse-angled triangles, which take areas A, B, and C, as shown in Figure 5. Now we show the extension of the previous system to the whole plane [15]. The continuous coordinate system Ω uniquely addresses every point of the plane. It is a combination of discrete triangular coordinate systems using only integer values, including the one we have just mentioned, with the barycentric coordinate system by Möbius (see, e.g., [1,39]). Each trixel, i.e., equilateral triangle of the triangular grid (drawn by black lines in Figure 4) is divided into three inner obtuse-angled triangles, which take areas A, B, and C, as shown in Figure 5. The coordinate triplets with sum + 1 and -1 are used to represent the midpoints (represented by m in Figure 5), depending on the orientation of the original triangle. Based on the coordinates of m we compute the coordinates of a point in any of the three regions (A, B, and C). Notice, that the regions in the grid, in fact, are rhombuses, thus any point inside can be addressed by two fractional values u and v. Consequently, 0 ≤ u ≤ 1 and 0 ≤ v ≤ 1 hold. See Figure 6 for an area Type A, and Figure 7 where it is explained for each area type around a point m addressed with integer triplet with sum 1. Now, the most important properties of Ω will be recalled, details can be found in [15]. The coordinate triplets with sum + 1 and −1 are used to represent the midpoints (represented by m in Figure 5), depending on the orientation of the original triangle. Based on the coordinates of m we compute the coordinates of a point in any of the three regions (A, B, and C). Notice, that the regions in the grid, in fact, are rhombuses, thus any point inside can be addressed by two fractional values u and v. Consequently, 0 ≤ u ≤ 1 and 0 ≤ v ≤ 1 hold. See Figure 6 for an area Type A, and Figure 7 where it is explained for each area type around a point m addressed with integer triplet with sum 1. Now, the most important properties of Ω will be recalled, details can be found in [15].  Now we show the extension of the previous system to the whole plane [15]. The c tinuous coordinate system Ω uniquely addresses every point of the plane. It is a combi tion of discrete triangular coordinate systems using only integer values, including the o we have just mentioned, with the barycentric coordinate system by Möbius (see, e [1,39]). Each trixel, i.e., equilateral triangle of the triangular grid (drawn by black lines Figure 4) is divided into three inner obtuse-angled triangles, which take areas A, B, a C, as shown in Figure 5.    In the next subsection, we will recall the conversion between Ω and the Cartesian coordinate system.    In the next subsection, we will recall the conversion between Ω and the Cartesian coordinate system. In the next subsection, we will recall the conversion between Ω and the Cartesian coordinate system.

Converting Triplets to Cartesian Coordinates and Vice Versa
In Ω, axes I, J, and K are used to describe the triangular plane (Figure 2b), consequently, triplet (i, j, k) is used to identify a point in Ω. The usual notation (x, y) is used to indicate a point in the Cartesian plane, based on coordinate axes X and Y. The side-length of the trixel of the triangular grid is fixed to be √ 3, and the height is 1.5. Then, Equation (1) is used to compute the corresponding coordinate values x and y for the given triplet (i, j, k). The conversion is recalled from [15].

Lemma 3.
For any triplet (i, j, k) of the continuous coordinate system, the Cartesian (x, y) is computed by Now, the conversion to the inverse direction is shown. The whole plane built up by rhombuses of Types A, B and C as it can be seen in Figure 9. The conversion of the Cartesian coordinates to equivalent triplets of Ω depends on the type of the area where the point (x, y) lies.

Converting Triplets to Cartesian Coordinates and Vice Versa
In Ω, axes I, J, and K are used to describe the triangular plane (Figure 2b), consequently, triplet (i, j, k) is used to identify a point in Ω. The usual notation (x, y) is used to indicate a point in the Cartesian plane, based on coordinate axes X and Y. The side-length of the trixel of the triangular grid is fixed to be √3, and the height is 1.5. Then, Equation (1) is used to compute the corresponding coordinate values x and y for the given triplet (i, j, k). The conversion is recalled from [15]. For any triplet (i, j, k) of the continuous coordinate system, the Cartesian (x, y) is computed by

Lemma 3.
Now, the conversion to the inverse direction is shown. The whole plane built up by rhombuses of Types A, B and C as it can be seen in Figure 9. The conversion of the Cartesian coordinates to equivalent triplets of Ω depends on the type of the area where the point (x, y) lies.   Table 1 is used to compute the continuous coordinate triplet (i, j, k) of the same point. In Area A, first coordinate i, then coordinate k and finally coordinate j are computed. In Area B, the computation starts with j, then i and k follow. In Area C, the sequence of computation starts with k, then continues with i and j. Figure 9. The plane is tessellated by three types of rhombuses; it can also be seen as the surface of a mesh of the cubic grid having three faces of each cube on the surface.

Lemma 4.
Knowing the area where (x, y) belongs, the appropriate formula of Table 1 is used to compute the continuous coordinate triplet (i, j, k) of the same point. In Area A, first coordinate i, then coordinate k and finally coordinate j are computed. In Area B, the computation starts with j, then i and k follow. In Area C, the sequence of computation starts with k, then continues with i and j.
* Rounding operation returns the nearest integer to the real number, such that numbers exactly the same distance from two integers are rounded to the larger absolute valued one, e.g., 2.5 = 3, −2.5 = −3 and −0.35 = 0.

Procedure for Adding Vectors in Ω
In contrast to the simplicity of vector addition in the Cartesian system (where it is really only an algebraic addition on the coordinate components), the addition in Ω is not so straightforward, i.e., adding two vectors directly (algebraically) may give an improper vector to Ω (see Figure 10a,b). Therefore, some modifications on the direct-sum (s) of the vectors are needed to get the result-vector (r), which is compatible with Ω. As direct addition of the vectors do not work in general, one can see that our (coordinate) system is not linear. Actually, as Figure 9 shows we may consider it in a way that the points of the Euclidean plain are mapped to a cubic mesh surface built up by faces of the cubes.
Let us consider two vectors v 1 = (i 1 , j 1 , k 1 ) and v 2 = (i 2 , j 2 , k 2 ) of Ω with their coordinate triplets. Let the algebraic, direct-sum of the vectors be s = (i, j, k) = (i 1 + i 2 , j 1 + j 2 , k 1 + k 2 ). This vector may not represent any point of Ω. To describe our method and formula mathematically, we shall introduce some more notions and notations.

Area A Area B Area C
* Rounding operation returns the nearest integer to the real number, such that numbers exactly the same distance from two integers are rounded to the larger absolute valued one, e.g., 〈2.5〉 = 3, 〈−2.5〉 = −3 and 〈−0.35〉 = 0.

Procedure for Adding Vectors in Ω
In contrast to the simplicity of vector addition in the Cartesian system (where it is really only an algebraic addition on the coordinate components), the addition in Ω is not so straightforward, i.e., adding two vectors directly (algebraically) may give an improper vector to Ω (see Figure 10a,b). Therefore, some modifications on the direct-sum (s) of the vectors are needed to get the result-vector (r), which is compatible with Ω. As direct addition of the vectors do not work in general, one can see that our (coordinate) system is not linear. Actually, as Figure 9 shows we may consider it in a way that the points of the Euclidean plain are mapped to a cubic mesh surface built up by faces of the cubes.

Further Definitions and Notations
The coordinate values of each vector are real numbers, having some integer and fractional parts. We use the following description for them.
Each coordinate value x consists of:

Further Definitions and Notations
The coordinate values of each vector are real numbers, having some integer and fractional parts. We use the following description for them.
Each coordinate value x consists of: (1) x : The integer part of x with sign, i.e.; x = sgn(x)· |x| = sgn(x) |x| − 1 2 , where and x is the floor function, that is applied on the absolute value of x above. One may also use the rounding operation that we have already defined in Table 1.
Example 1. In order to have a valid addition of two vectors in Ω producing correct result in Ω, some calculations must be done. In these calculations, the following two notions, the Rsum and the region, must be defined first: (1) Rsum = i + j + k , where i, j, and k are the coordinate values of the directsum s. (2) The region is based on the signs of the coordinates of the direct-sum. Accordingly, the triangular grid is partitioned into six regions based on the signs of the coordinates of the triplet used in the region, as it is shown in Figure 11a where sum is the sum of the three coordinate values of direct-sum vector, i.e., sum = i + j + k.
Entropy 2021, 23, x FOR PEER REVIEW 10 of 23 and is the floor function, that is applied on the absolute value of x above. One may also use the rounding operation that we have already defined in Table  1. In order to have a valid addition of two vectors in Ω producing correct result in Ω, some calculations must be done. In these calculations, the following two notions, the Rsum and the region, must be defined first:

1)
= + + , where i, j, and k are the coordinate values of the direct-sum s.
2) The region is based on the signs of the coordinates of the direct-sum. Accordingly, the triangular grid is partitioned into six regions based on the signs of the coordinates of the triplet used in the region, as it is shown in Figure 11a where sum is the sum of the three coordinate values of direct-sum vector, i.e., sum = i + j + k.

The Algorithm for the Computation
Our calculations are given in the algorithmic form. The procedure below computes the result of the addition of the two input vectors. The computation is based on the types of the two added vectors (the areas A, B, or C they belong to) and some features of the direct-sum s = (i, j, k).

The Algorithm for the Computation
Our calculations are given in the algorithmic form. The procedure below computes the result of the addition of the two input vectors. The computation is based on the types of the two added vectors (the areas A, B, or C they belong to) and some features of the direct-sum s = (i, j, k).
This procedure contains three steps. The first two steps are used to gain only the type of the result-vector r (A, B or C), whereas the last step, the third one, is for calculating the value of the result-vector (r). The result-vector (r) will be the final correct vector, while the direct-sum (s) will be the vector that is generated by direct addition, which is in many cases, incompatible with Ω. In the next subsections, we will explain the above procedure in detail.

3.3.
Step 1: Finding the Direct-Sum, Rsum, and the Region The first step of this procedure is to find the direct-sum s, the Rsum value, and the region, as mentioned above.
For simplicity, only the region of (+, −, −) is considered in the next description, while for all other regions similar calculation methods are applied. Now, regarding the Rsum value, note here that whenever we add two vectors of the same type, at the region (+, −, −), the value of Rsum is in the set {−1, −2, 0}. More precisely, within the three coordinate values of each vector, one is an integer value; thus, actually, the fractional parts of the other two coordinate values are responsible for producing one of the three values of the set above.
For a better explanation, consider Table 2 In contrast, the addition of two vectors of different types at this region, (+, −, −), will produce only two possible values of Rsum from the set {−1, 0}, where at most one carry could be occurred in these cases. (See Table 2, Samples (d) and (e).) Table 2. Different samples to demonstrate the first step of the procedure (boldface coordinate values produce carry values).
In order to demonstrate the three cases above, let us consider the first one, while the other two points would have a similar demonstration.
Assume that a = (i, j, k) is the midpoint of a positive triangle. Let P be any point (vector) in Area A with corner point a. Then, by the barycentric equation we have: The values of (b − a) and (c − a) are fixed for all points in the given Area A (see also Figure 6b), hence we have: Since the region of (+, −, −) is considered here, then: i : Since i is a positive integer, then i equals to i itself. j − v : Since j is a negative integer, then j − v equals to j − 1. k − u : Since k is a negative integer, then k − u equals to k − 1. Then Rsum = i + (j − 1) + (k − 1), but since (i, j, k) is a positive midpoint then i + j + k = 1, hence, Rsum = −1. Therefore, two vectors of Type A would produce a new vector of Type A if and only if the Rsum value is equal to −1.
The type of the result-vector could be one of the three possible types (A, B or C). We have already seen one of the possibilities, it has been obtained for a particular Rsum value, and the remaining two possibilities are going to be determined in the next part.
Before determining the other possibilities, it is worth mentioning here that, since every direct-sum has one value among its three coordinates with a different sign, based on the region signs, it is inconvenient to use logical comparison operations (<, >, min or max) among the values {i}, {j}, and {k}. (There is also a kind of imprecision by a lack of agreement in mathematics, programming and various software or calculators to compute fractional parts of negative numbers, e.g., the fractional part of −0.35 can be 0.35, or −0.35, or 0.65 by using various approaches (various software). Thus, to make it clear how our computation process is going, we give some technical details to avoid the mentioned ambiguity.) One of the "technical tricks" used in our procedure is to unify these signs, just for the comparison purpose, such that all of them must be converted to one of the two signs, either all positive or all negative. Here, since we are describing the region (+, −, −), we will convert those fractional parts that have zero or positive factional value into negative values by subtracting 1 from them. Formally, we can introduce the following technical notation: In a similar manner, notations {j} and {k} for the fractional parts {j} and {k} are also used to guarantee that the conversion is utilized to unify the signs if needed. See also Example 2. It is also possible to convert the negative fractions to positive ones, but in this explanation we use negative fractions. Clearly, in this way, integers have the smallest fractional part, and we can really compare the values without having problem caused by the signs in various software tools as we have already mentioned; the result does not depend on the used programming and software environment. For the sake of clarity we also provide a simple example. If vectors of different types were added, apart from the Rsum value, the maximum (or minimum) value among some values related to {i}, {j}, and {k} will also be evaluated and thus the type of the result-vector would be specified. In order to specify the result-vector type in all other cases, see Table 3.
Note here that when applying comparison operation on equal values then selecting any of the given types would be correct, because the point is on a border line or it is a vertex. Table 3. All conditions and rules for specifying the type of result-vector.

Regions
Vectors

Step 3: Finding Coordinate Triplet of the Result-Vector
Once the type of the result-vector has been determined, we proceed to Step 3. Where part (a) has three possibilities based on the type of the result-vector, as follows.

•
If the type of the result-vector is A, then its coordinate triplet is: where {i 1 } and {i 2 } are the fractional parts of the first coordinate value of the first and second vectors, respectively.
• If the type of the result-vector is B, then its coordinate triplet is: where {j 1 } and {j 2 } are the fractional parts of the second coordinate value of the first and second vectors, respectively.
• If the type of the result-vector is C, then its coordinate triplet is: where {k 1 } and {k 2 } are the fractional parts of the third coordinate value of the first and second vectors, respectively. Eventually, part (b) of this step, is about subtracting or adding 1 from/to each coordinate value, is applied if their sum is greater than 2 or less than −2, respectively. Theorem 1. The Procedure is correct, for any two vectors z = (i 1 , j 1 , k 1 ), w = (i 2 , j 2 , k 2 ) ∈ Ω it produces the vector r = (i 3 , j 3 , k 3 ) = z + w ∈ Ω.
Proof. The proof has been moved to the Appendix A for better readability.
To display also the applicability of our result, we show also a detailed example. Table 4, which includes three samples to show different cases, we show examples. To give a detailed view, consider Sample (a) of Table 4 Table 1 are applied in the following order:

Example 3. In
Then the corresponding triplet of (3.000, 2.850) is r = (2.582, −2.000, −0.882), which is exactly the same answer our procedure gives in Table 4 as it should be.  We close this section by the following remarks. Notice that our procedure to add two vectors has a constant time complexity, thus it can be used very efficiently in any type of computation, where some grid points of the triangular grid may be transformed outside of the grid.

Vector Arithmetic and its Application
In this section our aim is twofold: first, we apply the previous results to give a more general vector arithmetic system; and second, we present a real-life application scenario of our newly investigated system.

Subtraction and Scalar Product
Whenever, one is able to add two vectors, it is straightforward to apply again addition on the result vector with some other vectors, thus by applying the addition scheme for two vectors, as we have described, one can add any finite number of vectors.
Regarding the subtraction operation, we have the following: In Ω, for any vector v = (i,j,k) its opposite is −v = (−i, −j, −k), such that v + (−v) = (0,0,0). Table 1, using −x and −y instead of x and y, one may observe that every formula for the coordinate triplet gives −1 times its original value, consequently, if (x,y) is transformed to (i,j,k), then (−x, −y) is transformed to (−i, −j, −k) completing the proof.
Proof. To see that the formula is correct, one needs to apply Lemma 5.
Finally, we investigate scalar product with integer multiplier.

Theorem 3.
Let v ∈ Ω and n be an integer. The following procedure will provide the vector r = n· v.
Input: v = (i, j, k) and integer n. Output: r = (i r , j r , k r ) the scalar product of the number n and vector v.

Proof.
Step 1 gives the answer as the null-vector in obvious case. If the coefficient n is negative, the solution is computed based on the identity −m · v = m · (−v), where m is a non-negative integer, based on Lemma 5 and Theorem 2. Whenever, n = 1 or n = −1 we do not need to do any addition, the result is either same as the original value v or it is −v.
Vector addition is iterated in the for loop if |n| ≥ 2 till the final result is obtained in the vector variable r.

Proof.
Step 1 gives the answer as the null-vector in obvious case. If the coefficient n is negative, the solution is computed based on the identity -m ⋅ v = m ⋅ (-v), where m is a nonnegative integer, based on Lemma 5 and Theorem 2. Whenever, n = 1 or n = -1 we do not need to do any addition, the result is either same as the original value v or it is -v. Vector addition is iterated in the for loop if |n| ≥ 2 till the final result is obtained in the vector variable r. □ Example 4. Figure 12 shows some applications: In Figure 12

Application: Drawing and Imaging on a Cubic Mesh
Let us consider the three-dimensional space built up by unit cubes. Considering a mesh with norm (1,1,1) we got an oblique plane which is closely related to the hexagonal

Application: Drawing and Imaging on a Cubic Mesh
Let us consider the three-dimensional space built up by unit cubes. Considering a mesh with norm (1,1,1) we got an oblique plane which is closely related to the hexagonal and triangular grids considering only the grid-points [38]. However, considering the whole surface of the square faces of the cubes which are on the boundary, a three-dimensional surface is obtained which has a one-to-one correspondence with the continuous triangular plane with the coordinate triplets, somewhat similarly as the image of Figure 9 can be seen as such a cubic mesh. The vector arithmetic we have studied here fits well to this surface, because the coordinate systems are identical. Thus, to draw on this surface, one can compute which points should have what color based on our results. In addition, if an image is drawn in this surface, to capture it and/or to do any modifications, e.g., translation, or enlarging (zoom in) it to double size, our results can efficiently be used.

Example 5.
Let an image be on the cubic mesh surface that contains the points v 1 , . . . ,v 8 (shown by blue color in Figure 13). Then, translating this image by the vector k = (−0.848, −0.353, 1), the points u 1 , . . . , u 8 (shown by red color in Figure 13) are obtained to form the translated image.   Example 6. Let a star shape image be given by the points a 1 , . . . , j 1 , as it is shown in Figure 14 by blue color. The double and triple sized images can be computed by the scalar product of the vectors addressing the points a 1 , . . . , j 1 by scalar 2 and 3, respectively. The obtained points are shown by red and green color with Indices 2 and 3 with their coordinate values in the figure.

Conclusions
The discrete symmetric coordinate systems for the triangular grid have been extended to the continuous coordinate system. In this paper vector addition, subtraction and scalar product (with integer coefficients) are studied in this system showing that although vector arithmetic is more complex in this grid than on usual point-lattices, e.g., on rectangular grids, one can manage it with short and efficient codes (with some formulae depending on various cases described by a set of conditions). As a first possible real-life application, we shown how drawing and imaging can be done on the non-linear surface of a mesh on the cubic grid where the points of the square surfaces of the cubes on the boundary can be addressed by our continuous coordinate system. However, this symmetric coordinate system is indeed very helpful for various applications concerning the triangular grid, where the grid points are not necessarily mapped to grid points, e.g., arbitrary angled rotations, zooming or interpolation of images. This coordinate system provides a new tool: on the one hand it can be converted to/from the Cartesian coordinate system, but, more importantly, on the other hand, with the vector arithmetic presented here, it can directly be used to transform images of the triangular plane. Vector arithmetic including vector addition is very fundamental tool for working with images. By extending our work with a digitization/re-digitization which is mapping every point of a triangle pixel to the midpoint of the triangle by identifying the trixel where the point belongs, our system is ready to use for research and applications of digital images on the triangular grid such as imaging, computer graphics, image manipulation, image processing and analysis including various applications e.g., transformations and other operations that do not necessarily map the grid to itself. The presented and used coordinate system is continuous and, therefore, there is no information loss with isometric transformations, similarly to the case when the entire plane is addressed by the Cartesian coordinate frame. The information loss which is an important factor at various transformations, e.g., rotations of digital images is coming when the result is re-digitized, which operation, of course, causes certain information loss in many cases either or both on the square and on the triangular grids. Some preliminary studies on the digital rotations comparing these grids can be found in [40].
It is a topic of future work to find a short way to compute also scalar product with fractional values.  u 1 , v 1 , u 2 , v 2 < 1; the proof for the special cases when one or both vectors are on the border of the region goes in analogous way). By the addressing scheme of the coordinate system, we know that i 1 + j m1 + k m1 = 1 and i 2 + j m2 + k m2 = 1. Now, we can consider our procedure. Since i is integer, Rsum = i + j + k = i + j m1 − u 1 + j m2 − u 2 + k m1 − v 1 + k m2 − v 2 and by taking out the integers from the special rounding operator, we get Rsum = i + j m1 + j m2 + k m1 + k m2 − u 1 + u 2 − v 1 + v 2 = 2 − u 1 + u 2 − v 1 + v 2 . The value of any or both of u 1 + u 2 , v 1 + v 2 is 1 or 2, thus Rsum is in {−2,−1,0} in our cases (as it was already explained earlier). Note that in the given region {j} = {j} and {k} = {k} in case j and k are not integers and the corresponding value is −1 in case a given value is integer, since both these coordinates are negative. We show the proof for the case when also the resulted vector r is inside a given region (when it is on the border the proof is analogous), and in these cases {j} = {j} and {k} = {k}. There are three subcases according to the value of Rsum and the values of {j} and {k}.

A.
By our procedure, if Rsum = −1, then vector r is of Type A and since i is integer, in fact, it is r = s = (i, j, k). If Rsum = −1, then either ( u 1 + u 2 = 1 and v 1 + v 2 = 2), or ( u 1 + u 2 = 2 and v 1 + v 2 = 1). Equivalently, (u 1 + u 2 ≤ 1 and v 1 + v 2 > 1) or (u 1 + u 2 > 1 and v 1 + v 2 ≤ 1). In both cases, i + j + k = i + j m1 + j m2 + k m1 + k m2 − (u 1 + u 2 ) − (v 1 + v 2 ) = 2 − (u 1 + u 2 ) − (v 1 + v 2 ), and thus 1 ≥ i + j + k ≥ −1 holds, thus no correction is needed. As this triplet is converted exactly to r'= √ 3(i−k) 2 , i−2j + k 2 , this result matches, proving that our procedure gives the sum correctly in the case when the sum is also a Type A vector. To complete the proof of this subcase, we check also that the vector (i, j, k) is valid in Ω. Thus, let us prove this part by converting the Cartesian coordinates of r' to the corresponding triplet coordinates. Let us compute the coordinate triplet r = (l, m, n) assigned to r'. From the first column of Table 1, the values of l, n and m, in this order can be determined. The first coordinate l = In the given region i is always a positive integer, while j and k have non-positive values, moreover we can substitute them based on j = j m1 − u 1 + j m2 − u 2 and k = k m1 − v 1 + k m2 − v 2 by using the abbreviations j m1 = j m1 + j m2 , k m = k m1 + k m2 , u = u 1 + u 2 and v = v 1 + v 2 . Thus, we have l = i−k m + v