Keywords

1 Introduction

The computer representation of lines and curves have been an active subject of research for nearly half a century and produced some well-established facts regarding digital straightness. Digitization of a real coordinate value to an integer value is called quantization. There exist many quantization schemes for 2D and 3D curves— Square Quantization [7, 8, 10], Convex Quantization [13], 3D Convex Quantization [13], etc.

One of the applications of digital quantization occurred in digital straight line. The digital arc, S, is the digitization of a straight line segment which is stated in [12, 17]. The representation of digital straight line and its various properties are discussed in [3,4,5,6, 14, 16, 19]. The 2D and 3D representations of digital curve are proposed in [9]. The representation of 3D curves using chain codes are stated in [1]. A quantitative approach to represent, generate, and classify 3D discrete closed curves are discussed in [2]. In [18], a new chain code to represent 3D discrete curves is discussed which is based on a search for relative changes in the 3D Euclidean space. A set of 3D curve-skeletons is also studied. The 3D extension of Bresenham’s algorithm is proposed in [15]. The main contribution of the paper is the study of the chord property in 3D and the properties of 3D digital straight lines, which have not yet been done as far as our knowledge goes.

2 Preliminaries

There are three neighborhoods in \(\mathbb {Z}^3\). Those are 6-neighborhood (face neighbors), 18-neighborhood (face-edge neighbors), and 26-neighborhood (face-edge-vertex neighbors). Let \(r=(x_r,y_r,z_r)\in \mathbb {Z}^3\) and \(s_i = (x_{s_i},y_{s_i},z_{s_i}) \in \mathbb {Z}^3\) be all points satisfying \(max(|x_r-x_{s_i}|,|y_r-y_{s_i}|,|z_r-z_{s_i}|)\leqslant 1\).

\(N_6(r)=\{s_i: |x_r-x_{s_i}|+|y_r-y_{s_i}|+|z_r-z_{s_i}| \leqslant 1\}\)

\(N_{18}(r)=\{s_i: |x_r-x_{s_i}|+|y_r-y_{s_i}|+|z_r-z_{s_i}| \leqslant 2\}\)

\(N_{26}(r)=\{s_i: |x_r-x_{s_i}|+|y_r-y_{s_i}|+|z_r-z_{s_i}| \leqslant 3\}\)

These are shown in Fig. 1. The voxels at distance ‘1’, ‘2’, and ‘3’ are shown in red, magenta, and yellow colors respectively.

The 3D digital curve can move in any of the 26 directions. These directions are denoted by 26 English alphabets (Fig. 2). The sequence of these letters gives a 3D arc and the sequence is termed as chain codes in 3D. For example, a denotes movement along X-axis, b denotes movement along XZ plane, i denotes movement along XY plane, j denotes movement along three directions at a time (i.e., X-, Y-, and Z-directions), etc. A 3DSS can be represented by chain codes using these directions in alphabetical notations.

Fig. 1.
figure 1

The three neighborhoods. (Color figure online)

Fig. 2.
figure 2

The 26 directions of 3DSS.

Fig. 3.
figure 3

The chord property of a 3D digital straight line.

3 Chord Property in 3D

Let p and q be points of the subset of a 3D digital object S, and let pq denote the (real) line segment between p and q. We can define the chord property as follows. pq lies near S if, for any (real) point (xyz) of pq, there exists a (lattice) point (ijk) of S such that \(max ( |i - x|,|j - y |,|k - z|) < 1\). In Fig. 3(left), pq lies near S as, for any (real) point (xyz) on pq, there exists a (lattice) point (ijk) on S such that \(max(|i - x|,|j - y|,|k - z|) < 1\). So, the chord property is satisfied. In Fig. 3(right), there are (real) points (xyz) on pq, for which there does not exist a (lattice) point (ijk) on S such that the above mentioned inequality satisfy. Thus, the chord property is violated.

A digital arc in 3D is the digitization of a straight line segment if and only if it has the chord property. Whenever a 3D straight line is projected on any plane (XY-, ZX-, or YZ-plane), then it becomes a 2D digital straight line on that plane. A 3D digital straight line can be represented using a chain code.

Let us consider the direction vectors be \({\vartriangle x}\), \({\vartriangle y}\), and \({\vartriangle z}\) which may be in \(\mathbb {Z}^+\) or \(\mathbb {Z}^-\). When \({\vartriangle x}\) is positive, there are four possible combinations for positive or negative values of \({\vartriangle y}\) and \({\vartriangle z}\). Each combination corresponds to each outer face of the octant (Fig. 2). Each of \({\vartriangle x}\), \({\vartriangle y}\), and \({\vartriangle z}\) may be positive or negative and can have six possibilities in total. Thus, in total there are 24 (\(4\times 6\)) possible direction sets where each set has four directions. In other words, in a 2D plane there are eight possible direction sets considering three planes (XY-, YZ-, and ZX-planes). So, there are in total 24 (\(8 \times 3\)) possible direction sets.

Lemma 1

The digitization of a 3D straight line segment can have at most four directions in its chain code.

Proof

The possible directions where the straight line can move when \({\vartriangle x},{\vartriangle y},\) \({\vartriangle z}>0\) and \({\vartriangle x} \geqslant {\vartriangle y},{\vartriangle z}\) is shown in Fig. 4(a) in blue color. There are four faces (directions) through which the continuous straight line may pass. At each step when the straight line proceeds, there are four possible faces (directions) through which the continuous straight line may pass (Fig. 4(b)). Thus, there are four directions in the chain code of 3D straight line.

Fig. 4.
figure 4

(a) One face of 3DSS and four directions are there in one face, (b) Possible faces for the next step of the 3DSS. (Color figure online)

Theorem 1

The combination of any two chain codes of two 2D digital straight lines in any two 2D planes, gives the chain code of 3D digital straight line segment.

Proof

The projection of 3D digital straight line on XY-, YZ-, and ZX-plane are 2D digital straight lines [11]. Let two 2D digital straight line segment in XY- and ZX-plane be combined (chain codes having two types of values). There must be four possibilities while combining the two above mentioned 2D digital straight line segment as each one contains two types of values (considering all possible combinations for it). Four possible directions give a 3D digital straight line (Lemma 1).

Table 1. The conditions for a direction to have runs of multiple lengths for the direction vectors having \({\vartriangle x} \geqslant {\vartriangle y},{\vartriangle z}\).

4 Properties of 3D Digital Straight Line Segment

The properties of 3DSS represented by chain codes are explained as follows.

Property 1:

A chain code has at most four directions and one of the runs of a 3DSS may have multiple lengths and others will have length one.

The first part of the property 1 follows directly from Lemma 1. Here, we are considering the direction vectors where \({\vartriangle x} \geqslant {\vartriangle y},{\vartriangle z}\). The conditions for a direction to have runs of multiple length are stated in Table 1 with examples.

Property 2:

The number of directions in 3DSS chain code is one

  • when the three direction vectors are equal and non-zero

  • when any two direction vectors are zero

  • when any two direction vectors are non-zero and equal but the other is zero. The number of directions in 3DSS chain code is two

  • when any two direction vectors are equal and non-zero but the other is non-zero

  • when any one of the direction vectors is zero but the other two are not equal and non-zero

Table 2. The direction vectors and the corresponding chain codes.
Table 3. The middle direction in 3DSS chain code when \({\vartriangle x}\) is odd.
Table 4. The middle direction in 3DSS chain code when \({\vartriangle x}\) is even.

See examples in Table 2. The 3DSS will move in same direction when three direction vectors are equal and non-zero (i.e., movement in all three directions in each step). When the two direction vectors are equal, non-zero and the other is zero, the 3DSS will move in one direction only. If the two direction vectors are equal and all three direction vectors are non-zero, then the number of directions in the chain code is two. When the two direction vectors are equal to zero and the other is non-zero, the movement will be in one direction only. When the three direction vectors are not equal and any one of them is zero, the number of directions in the chain code is two.

Property 3:

For the direction vectors \({\vartriangle x} \geqslant {\vartriangle y},{\vartriangle z}\), if \({\vartriangle x}\) is odd, then the direction in the chain code of 3DSS at position \(\lceil \frac{{\vartriangle x}}{2} \rceil \) can be determined as stated in Table 3 . If \({\vartriangle x}\) is even, then the directions in the chain code of 3DSS at positions \(\frac{{\vartriangle x}}{2}\) and \(\frac{{\vartriangle x}}{2}+1\) can be determined (i.e., direction at the middle positions) as per the conditions stated in Table 4 .

Here, we are considering only one case where \({\vartriangle x}\geqslant {\vartriangle y},{\vartriangle z}\). If all the three direction vectors are even, then direction vectors can be reduced by dividing with their GCD. When any one of the direction vectors is odd, then some conditions are applied to determine the directions at middle positions (see Table 4).

Property 4:

For the direction vector \({\vartriangle x} \geqslant {\vartriangle y},{\vartriangle z}\) , if \({\vartriangle x}\) is odd, the directions in the chain code of 3DSS are mirror w.r.t. the middle position (i.e., at the position \(\lceil \frac{{\vartriangle x}}{2} \rceil \) ) in the chain code and the first and the last directions are equal to multiple occurring directions (stated in Table 1 ).

See the examples in Table 3. No such relation can be derived when \({\vartriangle x}\) is even. For the direction vectors (13, 2, 5) the chain code is \(\underbrace{abajaa}b\underbrace{aajaba}\), where \(\underbrace{abajaa}\) and \(\underbrace{aajaba}\) are mirror to each other. Here, the multiple occurring direction a appears at first and last positions in the chain code.

5 Conclusion

The chord property in 3D and 3D digital arcs are defined here, from which several properties of 3DSS in 26-neighborhood are analysed. The 3DSS will be different for other neighborhoods. This work has a theoretical importance in the field of combinatorics and digital geometry. In connection to this work, the properties of 3D digital plane can be determined as related future work.