On the recognition of digital planes in three-dimensional space

On the recognition of digital planes in three-dimensional space

Pattern Recognition Letters 12 (1991) 665-669 North-Holland November 1991 On the recognition of digital planes in three-dimensional space Chul E. K...

327KB Sizes 7 Downloads 62 Views

Pattern Recognition Letters 12 (1991) 665-669 North-Holland

November 1991

On the recognition of digital planes in three-dimensional space Chul

E. Kim

School of Electrical Engineering and Computer Science, Washington State University, Pullman, WA 99164-2752, USA

Ivan Stojmenovid Computer Science Department, University of Ottawa, Ottawa, Ontario, Canada KIN gB4

Received January 1991

Abstract Kim, C.E. and 1. Stojmenovid, On the recognition of digital planes in three-dimensional space, Pattern Recognition Letters 12 (1991) 665-669. Given a set of digital points in an n x n × n digital cube, Kim presented an O(n 4) time with O(n 2) space algorithm for deciding whether or not the set is a convex digital plane. Using the same characterization of digital planes, we improve the time complexity of the algorithm to O(n 2 log n) (while keeping the same memory requirements). When implemented in parallel, the paralle] time complexity of our algorithm is bounded by the running time for the construction of 3-D convex hull of a set of points in space.

1. I n t r o d u c t i o n

Consider a set P o f digital points in an n × n x n digital cube. P is a digital plane if there is a connected finite subset o f a plane whose digital image is P (the digital image is constructed such that whenever given plane intersect a coordinate line, the nearest digital point to the intersection becomes a point o f the digital image; in case o f ties some rules can be applied, which are discussed in Kim (1984)). T w o digital points are called neighbors if the difference in any coordinate a m o n g them is at most 1. A digital plane is convex if its projections o n t o the coordinate planes are convex. Since P is not a convex digital plane if the points

o f P in the same row f o r m m o r e than one run, we m a y assume that the input describing P is given by zl(i,j) and Zr(i,j), O<~i,j
0167-8655/91/$03.50 © 1991 -- Elsevier Science Publishers B.V. All rights reserved

665

Volume 12, Number 11

PATTERN RECOGNITION LETTERS

of the algorithm that improves the time complexity from O(n 4) to O(n 2 log n), keeping the same O(n 2) space. Section 3 introduces models of parallel computation used in the paper. Section 4 describes a parallel algorithm based on the same approach. The time complexity of our parallel algorithm is bounded by the running time for the construction of 3-D convex hull of a set of points in space, for which the best known algorithms run in O(log 2 n log* n) time (log*n is the smallest k such that log log ... log n ~
2. Sequential algorithm A sequential algorithm is given in Kim (1984) that determines whether a set P of digital points is a convex digital plane. The algorithm is based on a characterization that is easily readable from the algorithm below.

Algorithm convex-plane (P) Input. zl(i,j) and zr(i,j), O<<.i,j
Output. Returns 'true' if P is a convex digital plane and 'false' otherwise. Step 1. Check if there is a coordinate plane onto which the projection of P is one-to-one (i.e., no two points project to the same point), and if not then return (false). Step 2. Obtain Px, -Py, and Pz, which are projections of P onto (x=0)-, ( y = 0 ) - and (z=0)plane, respectively, and determine whether all of them are convex. If not then return (false). Step 3. Construct H(P), the convex hull of P. Step 4. Find a face of H(P) such that the distance between the plane containing the face and any point of P is less than one, and if found then return (true) else return (false). Steps 1, 2, and 3 in the algorithm (Kim (1984)) require O(n21ogn) time and O(n 2) space. How666

November 1991

ever, Step 4 requires O(n 4) time and same space, leading to overall O(n 4) time and O(n 2) space complexity of the algorithm (Kim (1984)). Here we present a new solution for Step 4 that suffices O(n 2 log n) time complexity. This would also improve the time complexity of the whole algorithm to O(n 2 log n). The procedure we present actually finds for every face of a convex polyhedron a vertex that is farthest from it, and then checks whether the smallest of the obtained facevertex distances is less than one. The major problem in Step 4 is that of finding the farthest vertex from each face of a given convex polyhedron. Let F,. be a face of polyhedron P with its unit normal vector (ai, bi, ci) , where a 2 + b 2 + c/2 = 1. We note that the farthest vertex of P from face F/belongs to a face Fj such that the angle (F/, Fj) formed by their unit normal vectors (ai, b i, ci) and (aj, bj, cj) is maximized for Fj. So the farthest vertex from face F,. is one of the vertices of such Fj, called the opposite face of F/. Note that if F/ and Fj are parallel, then the farthest vertex from face F i is any vertex of Fj; otherwise, if Fy has three vertices then we check them and choose the farthest one. However, if Fj has more than three vertices then (in order to keep an efficient solution) we should assign one point for Fj which is at a 'small' distance from an interior point of Fj, and is exterior of P. Then we repeat the algorithm below which will give, for each face F/, a face Fj which is a triangle. For a given face F/, the angle (F/,Fj) is maximized if

(ai, bi, ci) . (aj, bj, cj ) = aiaj + bibj + cicj is minimized. Since the distance between points

p: = (-ai, -bi, -ci) and pj = (aj, bj, cj) is (2(I +aiaj+ bibj+cicj)) I/2, aiaj+bibj+cic j is minimized if the distance between p~ and pj is minimized. Thus, to find the opposite face of F/, we only need to find the nearest point from p~=(-ai,-bi,-ci) among all points pj = (aj, bj, cj), where (aj, bj, Cj) is the unit normal vector of face Fj. Since the pjs are all on the unit sphere, the construction of a spherical Voronoi diagram for them and point location in it solve the problem. To obtain the spherical Voronoi diagram we

Volume 12, Number 11

PATTERN RECOGNITION LETTERS

first construct the convex hull R of points pj. Next for each point pj, we construct a plane Ty:

a j x + b j y + c j z = 1,

which is tangential to the unit sphere at pj. These tangential planes define a convex polyhedron Tcircumscribing the unit sphere. It can be shown that two such planes T / a n d Tj define an edge of T if and only if the corresponding points Pi and p) define an edge of R. Also each face of R corresponds to a vertex of T. Finally, the edges of the spherical Voronoi diagram are obtained by projecting the edges of T onto the unit sphere toward the center. The point location problem on the spherical Voronoi diagram can be solved by transforming it to the planar point location problem. We map the spherical Voronoi diagram and the points p~ onto two parallel planes tangent to the unit sphere by the central projection, where p~=(-ai,-bi,-ci) for Pi = (ai, bi, Ci)" We note that some ideas of the above solution are due to Lu (1986) which considered the problem of finding the opposite faces of two polyhedrons each of which has all of its vertices on each of two unit spheres. Our polyhedrons do not have its vertices on a unit sphere, and for its faces we find their opposite faces on the same polyhedron. Moreover, we present an exact solution to the spherical point location problem rather than stating its 'similarity' (Lu (1986)) with planar point location. Sequentially our digital plane recognition method makes use of the 3-dimensional convex hull construction (Preparata and Hong (1977)) and a planar point location method (cf. Kirkpatrick (1979), Preparata and Shamos (1985)); both problems can be solved in O(m log m) time where m is the input size ( m = n 2 in our case). Thus the following result follows.

Theorem 1, Given a set P o f digital points in an n × n x n digital cube, determining whether or not P is a digital plane can be done in O (n 2 log n) time with O(n 2) space.

3. Models of parallel computation This section describes the models of parallel

November 1991

computation for which we present parallel solutions to the digital plane recognition problem. One computational model used in the paper is the synchronous shared memory SIMD (single instruction multiple data) model in which concurrent reads are allowed, but no two processors should attempt to simultaneously write in the same memory location. We henceforth refer to this theoretical model as the CREW PRAM (concurrent read exclusive write parallel random access machine). We also consider a local memory model: meshconnected computers (MCC). A mesh-connected parallel computer of size n 2 is a set of n 2 synchronized processing elements (PEs) arranged in an n × n grid. Each PE is connected via bidirectional unit-time communication links to its four neighbors, if they exist. Each processor has a fixed number of registers and can perform standard arithmetic and comparisons in constant time. It can also send the contents of a register to a neighbor and receive a value from a neighbor in a designated register in constant time. Each PE in the leftmost column has an i/o port. Thus O(n 2) data can be 'loaded' in O(n) time such that each processor contains O(1) data. We use standard MCC data movement operations: rotating data within a row (column), sorting, compression of data, Random Access Read (RAR) and Random Access Write (RAW) (cf. Akl (1989), Nassimi and Sahni (1980, 1981), Thompson and Kung (1977)).

4. Parallel algorithms In this section we show how to implement every step of the digital plane recognition algorithm in parallel. The projection of P onto (z = 0)-plane is one-toone if and only if Z r ( i , j ) - % ( i , j ) <~0

for all O<~i,j
and this can be checked in constant time. To check whether or not the projection of P onto (x=0)plane is one-to-one, we assign O(n) processors for each fixed j and do the following in parallel: Use the O(n) processors to sort two sets, each of 2n elements, separately 667

Volume 12, Number II

PATTERN RECOGNITION LETTERS

{zt(i,j) l O<~i
and {z~(i,j) l O<~i
which can be done in O(logn) time on CREW PRAM (Cole (1986)), and in O(n) time on a MCC (in fact, for every j this is a linear array of processors, cf. Akl (1989)). Let q(k) and rr(k) be the ranks of k + I/2 and k - 1/2 in the respective sorted list, the smallest element having the rank of 0. Then r r ( k ) - q ( k ) is the number of digital points o f P projected onto (j, k) on (x = 0)-plane for the fixed j. The projection of P onto (x=0)-plane is one-to-one if r r ( k ) - q ( k ) ~< I

for all O<<.k
which can be checked by finding the maximum of these differences (cf. Akl (1989) for all models). Whether or not the projection of P onto (y = 0)plane is one-to-one can also be determined similarly. Therefore, Step 1 takes time bounded by a sorting step. Pz, the projection of P onto (z=0)-plane can be done in O(1) time by checking whether or not Z r ( i , j ) - z l ( i , j ) = O and Zr(i,j) 1 for the fixed j, and point (i, k) is a point of Py if r r ( k ) - q ( k ) > t l for the fixed i. Whether or not the projections are convex digital regions can be checked by the following criteria (Kim (1982)): A digital region is digitally convex if and only if the convex hull of the points o f the region contains no digital point which is not a point of the digital region. The parallel implementation of the criteria uses a planar convex hull algorithm (O(log n) for CREW PRAM (Aggarwal et al. (1986)), and in O(n) for MCC (Jeong and Lee (1990))) and the inclusion problem for a set of points in a convex polygon. The latter can be easily solved in parallel by sorting all points and vertices o f the convex polygon around an interior point of the given convex polygon and checking whether the line segment joining the interior point with each o f the given points intersects an appropriate edge o f the given convex polygon. The construction of H ( P ) (the 3-dimensional convex hull) in Step 3 is done in O(log2n log* n) time on a CREW PRAM with O(n 2) processors (Dadoun and Kirkpatrick (1987)) (log*n is the 668

November 1991

smallest k such that log log ,.. log n ~
References Aggarwal, A., B. Chazelle, L. Guibas, C. O'Dunlaing and C. Yap 0986). Parallel computational geometry. Proc. IEEE Syrup. FOCS, 468-477. Akl, S.G. 0989). The Design and Analysis of Parallel Algorithms. Prentice-Hall, Englewood Cliffs, NJ. Cole, R. 0986). Parallel mergesort. Proc. IEEE Syrup. FOCS, 348-355. Dadoun, N. and D. Kirkpatrick (1987). Parallel processing for efficient subdivision search. Proc. 3rd ACM Syrup. on Cornput. Geom., 205-214. Dehne, F., J.R. Sack and I. Stojmenovic (1988). A note on determining the 3-dimensionalconvex hull of a set of points on a mesh of processors.SWA T, Lecture Notes in Computer Science 318. Springer, Berlin, 154-161. Jeong, C.S. and D.T. Lee (1990). Parallel geometricalgorithms on mesh-connectedcomputers. Algorithmica 5, 155-177.

Volume 12, Number 11

PATTERN RECOGNITION LETTERS

Kim, C.E. (1982). Digital convexity, straightness and convex polygons. IEEE Trans. Pattern Anal. Machine Intell. 4, 618-626. Kim, C.E. (1984). Three-dimensional digital planes. IEEE Trans. Pattern Anal. Machine Intell. 6, 639-645. Kirkpatrick, D.G. (1979). Optimal search in planar subdivision. S I A M J. Comput. 12, 18-27. Lu, M. (1986). Constructing the Voronoi diagram on a meshconnected computer. Proc. IEEE Parallel Proc. Conf., 806-811. Nassimi, D. and S. Sahni (1980). Finding connected corn-

November 1991

ponents and connected ones on a mesh-connected parallel computer. SIAM J. Comput. 9(4), 744-757. Nassimi, D. and S. Sahni (1981). Data broadcasting in SIMD computers. IEEE Trans. Comput. 30(2), 101-106. Preparata, F.P. and S.J. Hong (1977). Convex hulls of finite sets of points in two and three dimensions. Commun. A C M 20, 87-93. Preparata, F.P. and M.I. Shamos (1985). Computational Geometry, An Introduction. Springer, Berlin. Thompson, C.D. and H.T. Kung (1977). Sorting on a meshconnected parallel computer. Comm. A C M 20(4), 263-271.

669