Literature DB >> 33804720

Vector Arithmetic in the Triangular Grid.

Khaled Abuhmaidan1, Monther Aldwairi2, Benedek Nagy3.   

Abstract

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.

Entities:  

Keywords:  coordinate systems; digital geometry; discretized translations; nonlinearity; nontraditional grid; triangular grid; triangular symmetry; vector addition; vector arithmetic

Year:  2021        PMID: 33804720      PMCID: PMC8004019          DOI: 10.3390/e23030373

Source DB:  PubMed          Journal:  Entropy (Basel)        ISSN: 1099-4300            Impact factor:   2.524


1. 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].
Figure 1

The three regular grids: the square, the hexagonal and the triangular grids and their grid points (midpoints of the pixels).

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.
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.

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.

2. 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].

2.1. Vector Additions as Translations

Translation is an isometric transformation. Any point (x,y) of the plain can be translated by any vector (t,t)∈ resulting in the point (x + t,y + t)∈. 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 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.
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.

2.2. 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).
Figure 4

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.
Figure 5

(a,b): Dividing each triangle to three areas—A, B and C. The letters assigned to the isosceles triangles are based on the orientation of sides. (c): The areas actually rhombuses in the plane.

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.
Figure 6

A composition of the barycentric technique and discrete coordinate system to address points p and q in the triangular plane by coordinate triplets in (a,b), respectively.

Figure 7

Addressing the points in a hexagon containing one area of each type, where the midpoint (m) of the hexagon has coordinates (i, j, k) and 0 ≤ u ≤ 1 and 0 ≤ v ≤ 1 in each area.

Now, the most important properties of Ω will be recalled, details can be found in [15]. The sum of the triplet of each point, in equal to 1, then it is the midpoint of a positive trixel; equal to −1, then it is a midpoint of a negative trixel; equal to 0, then the point is on the edge of a trixel; positive, then the point belongs to a positive trixel; negative, then the point belongs to a negative trixel. 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) as follows. The 1st coordinate value of every point in Area A is the same as the 1st coordinate value of the midpoint. The 2nd coordinate value of every point in Area B equals the 2nd coordinate value of the midpoint. Similarly, the 3rd coordinate value of any point in Area C equals the 3rd coordinate value of the midpoint. If a triplet contains two integer values, then the point is located on the line of the border between two different type areas. However, if three integers are in a triplet, then this triplet addresses either a midpoint or a vertex (corner) of a trixel. Figure 8 shows an example for a trixel and its regions. As another example, consider a triplet of the form (1, 0, k). It addresses a point on the line (side of the obtuse-angled triangle) between Areas A and B (0 ≤ k ≤ −1).
Figure 8

The corresponding constant coordinate value for each area.

In the next subsection, we will recall the conversion between Ω and the Cartesian coordinate system.

2.3. 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 , 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 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.
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.

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.
Table 1

Formulae for the coordinate triplets based on the type of the area. The operation 〈…〉 is a rounding operation *.

Area AArea BArea C
i x3+y3 x33+y+j 2x3+k
j i+k2y 2y3 i+k2y
k i2x3 i2x3 y3x3

* 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., , and .

3. 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.
Figure 10

(a) Consider vectors v1 = (0.387, −1, 0.213) and v2 = (0.677, 0, −0.477); both are Type B. In this case, the direct-sum of vectors will be s = (1.064, −1, −0.264), which is Type B as well and hence is a result-vector for Ω. (b) Consider vectors v1 = (0.173, −0.813, 0) and v2 = (0.677, 0, −0.477) of Types C and B, respectively. In this case, the direct-sum of vectors will be s = (0.851, −0.813, −0.477), which is not compatible with Ω showing the nonlinearity of the system.

Let us consider two vectors v1 = (i1, j1, k1) and v2 = (i2, j2, k2) of Ω with their coordinate triplets. Let the algebraic, direct-sum of the vectors be s = (i, j, k) = (i1 + i2, j1 + j2, k1 + k2). This vector may not represent any point of Ω. To describe our method and formula mathematically, we shall introduce some more notions and notations.

3.1. 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: : The integer part of x with sign, i.e.; , where 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. {x}: The fractional part of x with sign, i.e., : The absolute-rounding-up operation that rounds a number up in absolute value, such that: = 1 and = −1 {1.3} = 0.3 and {−1.3} = − 0.3 = 2 and = −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: , where i, j, and k are the coordinate values of the direct-sum s. 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,b. The region can be specified by checking the three coordinate values of s as follows. For each coordinate value, x, of the direct-sum vector, the sign is described as where sum is the sum of the three coordinate values of direct-sum vector, i.e., sum = i + j + k.
Figure 11

(a) The six regions of the triangular plane. (b) The signs of the coordinate triplet for each region of the triangular plane.

3.2. 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). If (v1 type = v2 type) Then, the type of r is determined based on the Rsum value and the comparison of {}, {}, and {} values. (Explained later, see Equation (3) and Table 3.) If (v1 type ≠ v2 type) Then, the type of r is determined based on the Rsum value and the minimum (maximum) of ({}, {}, and {} values. (Explained later, see Table 3.) Switch (r type): case A: let r: = (i − ({i1} + {i2}), j − ({i1} + {i2}), k − ({i1} + {i2})) case B: let r: = (i − ({j1} + {j2}), j − ({j1} + {j2}), k − ({j1} + {j2})) case C: let r: = (i − ({k1} + {k2}), j − ({k1} + {k2}), k − ({k1} + {k2})) If ((i + j + k) > 2) Then, let r: = (i − 1, j − 1, k − 1) 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, where Samples (a), (b), and (c) have additions of vectors, Type A. In Sample (a), the addition of the 2nd coordinate value is the only one that carries 1, therefore, Rsum = −1 is produced, while for Sample (b), the addition of the 2nd and 3rd coordinate values carries 1, thus Rsum = −2, whereas the addition of Sample (c) does not lead to carrying 1, hence Rsum = 0. Moreover, Samples (a), (b), and (c) generate the three possible values (−1, −2, and 0) of Rsum for the addition of two vectors of Type A at this region, (+, −, −). Carry in the direct addition may occur on the coordinates which have a nonzero fractional part in both input vectors v1 and v2.
Table 2

Different samples to demonstrate the first step of the procedure (boldface coordinate values produce carry values).

Sample (a)Sample (b)Sample (c)Sample (d)Sample (e)
Vector1(1.0,−0.6,−0.1)(1.0,−0.6,−0.3)(1.0,−0.6, −0.1)(1.0,−0.9,−0.4)(1.0,−0.9,−0.4)
Vector2(1.0,−0.9,−0.7)(1.0,−0.9,−0.7)(1.0,−0.2,−0.7)(1.9,−1.0,−0.9)(1.9,−1.0,−0.5)
direct-sum(2.0,−1.5,−0.8)(2.0,−1.4,−1.09)(2.0,−0.8,−0.8)(2.9,−1.9,−1.3)(2.9,−1.9,−0.9)
i, j,k 2, −2, −12, −2, −22, −1, −13, −2, −23, −2, −1
Rsum −1 −2 0 −1 0
Region(+, −, −)(+, −, −)(+, −, −)(+, −, −)(+, −, −)
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).)

3.4. Step 2: Finding the Type of the Result-Vector

As mentioned above, adding two vectors of the same type would produce any of the three possible values of Rsum. Only one of these values would lead directly to the type of the result-vector, while for the other two values one needs more steps to find it. However, the values of Rsum that lead directly to the type of the result-vector, in the region (+,−,−), are the following: If (adding vectors of types (A + A)) and (Rsum = −1) then the result-vector type is A. If (adding vectors of types (B + B)) and (Rsum = 0) then the result-vector type is B. If (adding vectors of types (C + C)) and (Rsum = 0) then the result-vector type is C. 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: Now, Since the region of (+, −, −) is considered here, then: : Since i is a positive integer, then equals to i itself. : Since j is a negative integer, then equals to j − 1. : Since k is a negative integer, then 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 {} and {} 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 a positive fractional part , then it will be converted to as 0.35 − 1 = −0.65. In addition, zero as a fractional part will be converted to −1, since 0 − 1 = −1. Therefore, whenever a comparison operation is applied, we use the fraction values with united negative sign {}, {}, and {}. Now, Rsum values are in the set {−2, −1, 0} and Rsum = −1 leads directly to have a result-vector of Type A. If Rsum = 0 and {} < {}, then the result-vector is of Type B, otherwise it is of Type C. If Rsum = −2 and {} > {}, then the result-vector is of Type B, otherwise it is of Type C. Note here that only {j} and {k} are considered but not {i} because the two added vectors are of Type A. 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.
Table 3

All conditions and rules for specifying the type of result-vector.

Regions Vectors of Type (A + A)
(−, −, + )(−, +, −)(+, −, + )(+, +, −)IF (Rsum = 0) THEN result-vector type is A
IF (Rsum = 1) & ({j¯}≤{k¯}) THEN result-vector type is B ELSE C
IF (Rsum = 1) & ({j¯}≥{k¯}) THEN result-vector type is B ELSE C
(−, +, + )IF (Rsum = 1) THEN result-vector type is A
IF (Rsum = 0) & ({j¯}≥{k¯}) THEN result-vector type is B ELSE C
IF (Rsum = 2) & ({j¯}≤{k¯}) THEN result-vector type is B ELSE C
(+, −, −)IF (Rsum = 1) THEN result-vector type is A
IF (Rsum = 0) & ({j¯}≤{k¯}) THEN result-vector type is B ELSE C
IF (Rsum = 2) & ({j¯}≥{k¯}) THEN result-vector type is B ELSE C
Regions Vectors of type (B + B)
(−, +, + )(−, −, + )(+, −, −)(+, +, −)IF (Rsum = 0) THEN result-vector type is B
IF (Rsum = 1) & ({i¯}≤{k¯}) THEN result-vector type is A ELSE C
IF (Rsum = −1) & ({i¯}≥{k¯}) THEN result-vector type is A ELSE C
(+, −, + )IF (Rsum = 1) THEN result-vector type is B
IF (Rsum = 0) & ({i¯}≥{k¯}) THEN result-vector type is A ELSE C
IF (Rsum = 2) & ({i¯}≤{k¯}) THEN result-vector type is A ELSE C
(−, +, −)IF (Rsum = 1) THEN result-vector type is B
IF (Rsum = 0) & ({i¯}≤{k¯}) THEN result-vector type is A ELSE C
IF (Rsum = 2) & ({i¯}≥{k¯}) THEN result-vector type is A ELSE C
Regions Vectors of type (C + C)
(−, +, + )(+, −, + )(+, −, −)(−, +, −)IF (Rsum = 0) THEN result-vector is of type C
IF (Rsum = 1) & ({i¯}≤{j¯}) THEN result-vector is of type A ELSE B
IF (Rsum = −1) & ({i¯}≥{j¯}) THEN result-vector is of type A ELSE B
(−, −, + )IF (Rsum = 1) THEN result-vector is of type C
IF (Rsum = 0) & ({i¯}≤{j¯}) THEN result-vector is of type A ELSE B
IF (Rsum = −2) & ({i¯}≥{j¯}) THEN result-vector is of type A ELSE B
(+, +, −)IF (Rsum = 1) THEN result-vector is of type C
IF (Rsum = 0) & ({i¯}≥{j¯}) THEN result-vector is of type A ELSE B
IF (Rsum = 2) & ({i¯}≤{j¯}) THEN result-vector is of type A ELSE B
Regions Vectors of type (A + B) or (A + C) or (B + C)
(−, −, + )(−, +, −)(+, −, −)IF (Rsum = 0) THEN Min({i¯},{j¯},{k¯}) is the result-vector type * IF (Rsum = 1) THEN Max({i¯},{j¯},{k¯}) is the result-vector type *
(+, −, + )(+, +, −)(−, +, + )IF (Rsum = 0) THEN Max({i¯},{j¯},{k¯}) is the result-vector type *IF (Rsum = 1) THEN Min({i¯},{j¯},{k¯})is the result-vector type *

* if {}, {} or {} is the minimum (maximum, resp.) then the result-vector type is A, B or C respectively. If any two or three values of {}, {} and {}, are equal then the result-vector would be on a border or on a vertex which means selecting any type of them would be correct.

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.

3.5. 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: r = (i − ({i1} + {i2}), j − ({i1} + {i2}), k − ({i1} + {i2})), where {i1} and {i2} 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: r = (i − ({j1} + {j2}), j − ({j1} + {j2}), k − ({j1} + {j2})), where {j1} and {j2} 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: r = (i − ({k1} + {k2}), j − ({k1} + {k2}), k − ({k1} + {k2})), where {k1} and {k2} 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. The Procedure is correct, for any two vectors z = (i ∈ Ω it produces the vector r = (i ∈ Ω. 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. In Table 4, which includes three samples to show different cases, we show examples. To give a detailed view, consider Sample (a) of Table 4 where we have:
Table 4

The full procedure to compute the result-vector with different samples. (boldface coordinate values produce carry values).

Sample (a)Sample (b)Sample (c)
v1 = (i1, j1, k1)(1.577, −2.0, 0.423)(1.155, −1.423, 0.0)(1.0, −0.735, −0.270)
v2 = (i2, j2, k2)(1.005, 0.0, −1.305)(0.808, 0.0, −0.808)(1.0, −0.966, −0.732)
Step 1
direct-sum (2.582, −2.0, −0.882)(1.963, −1.423, −0.808)(2.0, −1.701, −1.002)
Rsum 3 + (−2) + (−1) = 02 + (−2) + (−1) = −12 + (−2) + (−2) = −2
Region (+, −, −)(+, −, −)(+, −, −)
Step 2
Rule 1 and 2 If (Rsum = 0) Then BIf (Rsum = −1) ThenMax({i¯},{j¯},{k¯})If (Rsum = −2) & ({j¯} ≥ {k¯})Then B else C
Apply Rule 1 and 2 Max ((0.963−1), −0.423, −0.808) = −0.037 = {i¯}(−0.701) (−0.002)
Type of Result-vector B A C
Step 3
a) s = (i − ({j1} + {j2},j − ({j1} + {j2}),k − ({j1} + {j2}) )(i − ({i1} + {i2}),j − ({i1} + {i2}), k − ({i1} + {i2}) )(i − ({k1} + {k2}),j − ({k1 } + {k2}), k − ({k1} + {k2}) )
Apply a) s = (2.582,−2.0,−0.882)(1.0, −2.386, −1.771)(3.002, −0.699, 0.0)
b) Sum = Sum = −0.3, then no need for addition or subtraction of 1Sum = −3.157 < −2, then add 1 to each coordinate valueSum = 2.303 > 2, then Subtract 1 from each coordinate value
Result-vector (2.582, −2.0, −0.882)(2.0, −1.386, −0.771)(2.002, −1.699, −1.0)
v1 = (1.577, −2.0, 0.423) v2 = (1.005, 0.0, −1.305) By converting v1 and v2 into the Cartesian coordinates c1 and c2, using Equation (1), we have: For c1 = Then c1 = (x1, y1) = (0.999, 3.000) is the value of v1 with Cartesian coordinates, and for c2 = Then c2 = (x2, y2) = (2.001, −0.150) is the Cartesian vector that corresponds to v2. Now, applying the Cartesian addition to c1 and c2, we have: c = (x, y) = c1 + c2 = (3.000, 2.850) in Cartesian coordinates Finally, convert c = (x, y) into triplet in Ω, c belongs to the 1st quarter, and it belongs to Area B. Thus, formulae of Area B from Table 1 are applied in the following order: j = = −2.0 i = = + 2.85 − 2.0 = 2.582 k = = 2.582 − 3.464 = −0.882 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.

4. 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.

4.1. 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). Based on 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. □ Let v To see that the formula is correct, one needs to apply Lemma 5. □ Finally, we investigate scalar product with integer multiplier. Let v ⋅ v. Input: v = (i, j, k) and integer n. Output: r = (i, j, k) the scalar product of the number n and vector v. Step1) If n = 0 then let r: = (0,0,0). Stop. Step2) If n < 0 then let n: = − n and v: = − v. Step3) Let r: = v. Step4) If n = 1 then Stop. Step5) For h = 2 to n do Step6) Let r: = r + v. Step7) Endfor. Step8) Stop. 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. □ Figure 12 shows some applications: In Figure 12a, e.g., the scalar products 3 ⋅ (0.5, 0, −0.25) = (1.25, −0.25, −1) and 4 ⋅ (0.5, 0, −0.25) = (2, 0, −1) are shown. The vector subtraction (0, −0.5, 0) − (−0.25, 0, 0.75) = (0.75, 0, −0.25) which can also be interpreted as vector addition (−0.25, 0, 0.75) + (0.75, 0, −0.25) = (0, −0.5, 0) is shown in Figure 12b. Finally, Figure 12c shows −1 ⋅ (1, 0, 0) = (−1, 0, 0) and also as (1, 0, 0) + (−1, 0, 0) = (0, 0, 0).
Figure 12

Examples for vector arithmetic: (a) Consider the scalar product of vector v = (0.5, 0, −0.25) with a positive integer multiplier n = 4 (that is to compute v + v + v + v) which yields to vector r = (2, 0, −1). (b) Consider the addition of vectors v1 = (0.75, 0, −0.25) and v2 = (−0.25, 0, 0.75) which results in vector r = (0, −0.5, 0). (c) The addition of the opposite vectors v1 = (1, 0, 0) and v2 = (−1, 0, 0) give vector r = (0, 0, 0).

4.2. 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. Let an image be on the cubic mesh surface that contains the points v1,…,v8 (shown by blue color in Figure 13). Then, translating this image by the vector k = (−0.848, −0.353, 1), the points u1, …, u8 (shown by red color in Figure 13) are obtained to form the translated image.
Figure 13

Example of image translation by vector addition: the points represented by vectors v1, …, v8 have been translated by vector k = (−0.848, −0.353, 1) to get the points represented by vectors u1, …, u8.

Let a star shape image be given by the points a1, …, j1, 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 a1, …, j1 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.
Figure 14

Example for zooming an image by vector arithmetic: the star defined by points represented by vectors a1, …, j1 given in blue color are doubled and tripled, the resulted vectors and shapes are presented in red and green color.

5. 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.
  7 in total

1.  Geometric transformations on the hexagonal grid.

Authors:  I Her
Journal:  IEEE Trans Image Process       Date:  1995       Impact factor: 10.856

2.  Memory Pattern Identification for Feedback Tracking Control in Human-Machine Systems.

Authors:  Miguel Martínez-García; Yu Zhang; Timothy Gordon
Journal:  Hum Factors       Date:  2019-10-24       Impact factor: 2.888

3.  Attraction Controls the Entropy of Fluctuations in Isosceles Triangular Networks.

Authors:  Fabio Leoni; Yair Shokef
Journal:  Entropy (Basel)       Date:  2018-02-12       Impact factor: 2.524

4.  Skyrmions and Spin Waves in Magneto-Ferroelectric Superlattices.

Authors:  Ildus F Sharafullin; Hung T Diep
Journal:  Entropy (Basel)       Date:  2020-08-04       Impact factor: 2.524

5.  Structural and Thermodynamic Peculiarities of Core-Shell Particles at Fluid Interfaces from Triangular Lattice Models.

Authors:  Vera Grishina; Vyacheslav Vikhrenko; Alina Ciach
Journal:  Entropy (Basel)       Date:  2020-10-26       Impact factor: 2.524

6.  Degrees-Of-Freedom in Multi-Cloud Based Sectored Cellular Networks.

Authors:  Samet Gelincik; Ghaya Rekaya-Ben Othman
Journal:  Entropy (Basel)       Date:  2020-06-16       Impact factor: 2.524

7.  On Metric Dimension in Some Hex Derived Networks.

Authors:  Zehui Shao; Pu Wu; Enqiang Zhu; Lanxiang Chen
Journal:  Sensors (Basel)       Date:  2018-12-28       Impact factor: 3.576

  7 in total

北京卡尤迪生物科技股份有限公司 © 2022-2023.