Next Article in Journal / Special Issue
Univariate Cubic L1 Interpolating Splines: Analytical Results for Linearity, Convexity and Oscillation on 5-PointWindows
Previous Article in Journal
Ray Solomonoff, Founding Father of Algorithmic Information Theory
Previous Article in Special Issue
Segment LLL Reduction of Lattice Bases Using Modular Arithmetic
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Computation of the Metric Average of 2D Sets with Piecewise Linear Boundaries

1
School of Mathematical Sciences, Tel-Aviv University, Tel-Aviv, Israel
2
PTC Corp, Parametric Tech. Israel Ltd., Herzliya, Israel
*
Author to whom correspondence should be addressed.
Algorithms 2010, 3(3), 265-275; https://doi.org/10.3390/a3030265
Submission received: 5 May 2010 / Revised: 8 July 2010 / Accepted: 22 July 2010 / Published: 26 July 2010
(This article belongs to the Special Issue Algorithms for Applied Mathematics)

Abstract

:
The metric average is a binary operation between sets in R n which is used in the approximation of set-valued functions. We introduce an algorithm that applies tools of computational geometry to the computation of the metric average of 2D sets with piecewise linear boundaries.

1. Introduction

Approximation of set-valued functions has various potential applications in optimization, mathematical economics, control, robotics and more. While approximation of set-valued functions with convex sets as images can be achieved with methods based on Minkowski averages c.f. [1], it is shown in [2] that Minkowski averages are not suitable for approximation of set-valued functions with general (not necessarily convex) images. In order to develop approximation methods for set-valued functions with general images, other averaging operations on compact sets are required. Along with theoretical construction of such averaging operations, efficient algorithms for their computation are needed.
First introduced by Z. Artstein in [3], the metric average of two compact sets in R n is a union of weighted averages between any point from any of the two sets and the subset of all its closest points from the other set. The interest in the metric average is due to its metric property in relation to the Hausdorff distance [3]. The metric property of the metric average is that its Hausdorff distance from any of the averaged sets changes linearly with the weight parameter of the average.
In [3], the metric average is used for piecewise linear approximation of set-valued functions. Extending these results, Dyn et al. applied the metric average to the approximation of set-valued functions from a finite number of their samples, using spline subdivision schemes and more generally positive approximation operators [4,5]. These methods are based on repeated computations of the metric average.
The applicability of metric average based approximation methods requires efficient algorithms for the computation of the metric average of compact sets. An algorithm for the computation of the metric average of two 1D compact sets with computation time, which is linear in the number of connected subsets in the two sets, is introduced in [6]. A first step in the development of algorithms for the computation of the metric average of 2D sets is done in [7], where an algorithm for the computation of the metric average of two intersecting convex polygons is introduced and analyzed. The algorithm of [7] has linear time complexity in the number of vertices of the input polygons.
In this work we introduce an algorithm that applies tools of computation geometry, segment Voronoi diagrams (c.f. [8]) and planar arrangements (c.f. [9]) to the computation of the metric average of 2D sets with piecewise linear boundaries. Such sets are collections of simple polygons and of simple polygons with holes. Since a compact 2D set with boundary consisting of closed curves can be linearly approximated by a 2D set with piecewise linear boundaries, our algorithm provides a computational method for approximation of set-valued functions with 2D images from a finite number of samples.
Although the definition of the metric average of two sets with piecewise linear boundaries requires at least one operation for each point in the two sets, our algorithm reduces the computation to boundaries of cells of the partition of the two sets, obtained by the segment Voronoi diagram. The complexity of the algorithm is O n 2 log n , where n is the total number of vertices on the boundaries of the two sets.
Our algorithm is based on geometric objects such as segment Voronoi diagrams, arrangements of conic arcs and conic polygons with holes. We implemented the algorithm in C++, using the CGAL library [10], for handling the various geometric objects.
The outline of this paper is as follows. Section 2 contains definitions and notation. In particular we review the main geometric concepts relevant to our work such as the metric average, segment Voronoi diagrams, planar arrangements and conic polygons with holes. In Section 3 we present the algorithm for the computation of the metric average of two simple polygons. The algorithm is extended to general 2D sets with piecewise linear boundaries in Section 4. Examples of the metric average computed by our algorithm, are presented in Section 5. In Section 6 we derive the run-time complexity bounds for our algorithm and obtain bounds on the combinatorial complexity of the computed metric average. Conclusions and directions for possible extensions are given in Section 7.

2. Preliminaries

To define the metric average of two sets, we first introduce some notation. The Euclidean distance from a point p to a set A R n is
dist p , A = inf p q : q A ,
with | · | the Euclidean norm. A point q is called a projection point of a point p on a set A, if q belongs to the closure of A and p q = d i s t p , A . Generally the projection point is not unique, and the set of all projection points of p on A is denoted by Π A p . For two sets A , B and t [ 0 , 1 ] , we introduce the asymmetric operation M t ( A , B ) , which is the set of all t-weighted averages between any point in A and all its projection points on B, namely
M t ( A , B ) = t p + 1 t q : p A , q Π B p .
Finally the t-weighted metric average of two compact sets A , B is defined as,
A t B = M t A , B M 1 t B , A .
It is easy to verify that A t A = A , A 1 B = A , and A 0 B = B . An example of the metric average of two sets in 1D is given in Figure 1.
Since for p A B , the projection point of p on A, and also the projection point of p on B is the point p itself, we have
A t B = A B M t ( A B , B ) M 1 t ( B A , A ) ,
where ∖ denotes the usual set difference.
Now since for points outside a set, the projection on the set is equivalent to the projection on the boundary of the set, relation (2.3) can be further rewritten as,
A t B = A B M t A B , B M 1 t B A , A ,
where denotes the boundary of a set.
Next we briefly recall the definitions of the geometric objects used in this work. A collection of points p = ( x , y ) R 2 satisfying
a x 2 + b y 2 + c x y + d x + e y + f = 0 ,
with a , b , c , d , e , f R , is called a planar conic curve. We refer to segments of conic curves as conic segments.
A simple polygon is a region of the plane bounded by a single closed and not self-intersecting chain of linear segments, termed edges. A simple polygon with holes is a simple polygon that contains holes,
Figure 1. The metric average of two non-convex sets in 1D, where A = [ 0 , 1 ] [ 2 , 3 ] , B = [ 0 . 5 , 1 . 3 ] [ 1 . 7 , 2 . 5 ] , A 1 / 2 B = [ 0 . 25 , 1 . 15 ] [ 1 . 85 , 2 . 75 ] .
Figure 1. The metric average of two non-convex sets in 1D, where A = [ 0 , 1 ] [ 2 , 3 ] , B = [ 0 . 5 , 1 . 3 ] [ 1 . 7 , 2 . 5 ] , A 1 / 2 B = [ 0 . 25 , 1 . 15 ] [ 1 . 85 , 2 . 75 ] .
Algorithms 03 00265 g001
which are simple polygons. If we allow the edges to be conic segments, we get a simple conic polygon with holes. A set with piecewise linear boundaries is a collection of pairwise disjoint simple polygons with holes.
A collection of simple conic polygons with holes can be treated as a planar arrangement (c.f. [9]). Given a set C of bounded planar curves, the arrangement A ( C ) is the subdivision of the plane induced by the curves in C into zero-dimensional, one-dimensional and two-dimensional cells, called vertices, edges and faces respectively. The overlay of two arrangements A ( C 1 ) , A ( C 2 ) is the arrangement A ( C 1 C 2 ) produced by the edges from C 1 and C 2 .
Given a collection Σ of geometric objects in R 2 , called Voronoi sites, the Voronoi diagram (see e.g. [8,11]) of Σ is the subdivision of the plane into regions (called Voronoi faces), each region being associated with a site s i Σ , and containing all points of the plane for which s i is closest (with respect to the Euclidean distance) among all the sites in Σ. A Voronoi bisector is a set of points that are equidistant from two Voronoi sites. The Voronoi diagram induced by a collection of linear segments in R 2 is termed segment Voronoi diagram. The standard technique is to treat a segment as three disjoint geometric objects: two endpoints and an open segment [8]. The bisector between an open segment p i , p i + 1 and a point p i is defined by the line through p i that is perpendicular to p i , p i + 1 . We also assume that the diagram is bounded by a rectangular frame, which is large enough not to influence the computation of the metric average.

3. The Algorithm for Simple Polygons

Here we assume that A , B are simple polygons. We begin with the representation (2.4) of the metric average. The main part of the computation of the metric average is the computation of the sets M t A B , B and M 1 t B A , B with 0 < t < 1 . We describe in details the computation of M t A B , B . First we apply a sequence of reductions, which simplify the computations. The main idea is to partition A B by the segment Voronoi diagram induced by B . We show that it is sufficient to perform the computations only on the boundary curves of the cells of this partition.
Denote by V D B the collection of faces of the segment Voronoi diagram induced by the B . The Voronoi faces in V D B constitute a partition of the plane. Therefore the set A B can be represented as,
A B = F V D B ( ( A B ) F ) ,
and thus, by the definition of M t in (2.1),
M t A B , B = F V D B M t ( A B ) F , B .
Denoting by S F the Voronoi site associated with a Voronoi face F, we observe that by the definition of V D B , the closest point on B to p F V D B is on S F , and obtain
M t A B , B = F V D B M t ( A B ) F , S ( F ) .
We call a connected component of F ( A B ) with non-empty interior a metric face of F. For F ˜ a metric face of F, we define S ( F ˜ ) = S ( F ) . We denote by M F B ( A B ) the collection of all the metric faces induced by the Voronoi faces in V D B and by A B . With this notation (3.3) can be rewritten as,
M t A B , B = F M F B ( A B ) M t F , S ( F ) .
In order to compute M t A B , B using the reduction (3.4), it is required first to find the metric faces and then for each metric face F to compute M t F , S F ,
The computation of the metric faces are based on planar arrangements. The bisectors of the segment Voronoi diagram are conic curves [8], hence V D B constitutes an arrangement of conic segments. Obviously A B can be represented by an arrangement of linear segments. Thus the metric faces are the intersections of the bounded faces of the two arrangements and can be computed by the overlay of these two arrangements.
Next we show that the computation of M t F , S F for a metric face F can be further reduced to the computation of M t F , S F . The Voronoi site S ( F ) is either an open linear segment or a point, thus the set Π S ( F ) ( p ) of all projection points of a point p R 2 on S ( F ) is a singleton. It is easy to see, that the operation p M t p , S F , can be regarded as a continuous one-to-one function from the metric face F to R 2 . Consequently, M t F , S F is a simple closed curve, since the boundary of a metric face is so. Thus the region bounded by M t F , S F is M t F , S F , and it is sufficient to compute M t F , S F . Denoting by Ω M t F , S F the region bounded by M t F , S F , we have
M t F , S F = Ω M t F , S F .
Finally the computation is reduced to that of M t τ , S F for a conic segment τ on the boundary of a metric face F. This straightforward task is completed by a fixed number of operations. The obtained set M t τ , S F is also a conic segment, and therefore M t F , S F is a conic polygon.
To conclude, our algorithm computes the metric average of two simple polygons using (2.4), (3.4) and (3.5), and
M t F , S F = τ C F M t τ , S F ,
where C F is the collection of conic segments comprising F .

4. Extension to 2D Sets with Piecewise Linear Boundaries

The algorithm for the computation of the metric average of two simple polygons introduced in the previous section can be straightforwardly extended to 2D sets with piecewise linear boundaries, namely each set is a collection of simple polygons with holes. We discuss the computation of M t A B , B with such sets A , B .
The boundary of B consists of linear segments and therefore the segment Voronoi diagram V D B is well defined. The metric faces are defined as in the previous section, and Relations (3.1)-(3.4) stay valid. However a metric face F is now a connected component of the intersection of a Voronoi face with a collection of simple polygons with holes, so it is a simple conic polygon with holes. Let a metric face F be a simple conic polygon P with holes H 1 , , H n . The arguments of the previous section imply that M t F , S F is a simple conic polygon M t P , S F with holes M t H 1 , S F , , M t H n , S F . Consequently, the computation of M t F , S F is reduced to the computation of M t P , S F and M t H 1 , S F , , M t H n , S F .

5. Examples

We implemented the algorithm in C++, using the CGAL library [10] for computational geometry algorithms. In particular we used [12] for 2D arrangements, [13] for segment Voronoi diagrams and [14] for Boolean set operations. The input to the algorithm is two collections of polygons with holes comprising the input sets, and the output is a collection of conic polygons with holes comprising the computed metric average.
We present a collection of examples of the metric average of two sets with piecewise linear boundaries. In the following examples the boundaries of the input sets A , B are depicted in dotted green and blue respectively, and the boundary of their metric average is depicted in bold red.
Figure 2. A 1 / 2 B where A , B are simple convex polygons.
Figure 2. A 1 / 2 B where A , B are simple convex polygons.
Algorithms 03 00265 g002
Figure 3. A 1 / 2 B , where A is a simple polygon and B consists of two simple polygons included in A.
Figure 3. A 1 / 2 B , where A is a simple polygon and B consists of two simple polygons included in A.
Algorithms 03 00265 g003
Figure 4. A 1 / 2 B , where A , B are sets with piecewise linear boundaries.
Figure 4. A 1 / 2 B , where A , B are sets with piecewise linear boundaries.
Algorithms 03 00265 g004
The examples indicate that the metric average is more suitable for applications of set-valued approximation, where the Hausdorff distance between the sampled function and the approximant is of interest, but it is less suitable for geometry oriented applications. The geometric “artifacts” produced by the metric average are explained by the fact that the projection point on a set may move discontinuously for points near the boundaries between faces of the Voronoi diagram induced by the boundary of the set.

6. Complexity Bounds

In this section we discuss the run-time complexity bounds for our algorithm and the combinatorial complexity of the obtained set. We assume here that A , B are simple polygons, and the extension of the results of this section to 2D sets with piecewise linear boundaries is straightforward. The complexity bounds depend on the well known complexity of the underlying algorithms for the computation of segment Voronoi diagrams and planar arrangements.
Recall that by (2.4) and (3.4),
A t B = A B F M F B A B M t F , S F F M F A B A M 1 t F , S F .
Our main task in this complexity analysis is to show that (6.1) is a union of simple conic polygons with pairwise disjoint interiors. For this goal, we first prove several results about the metric average that will be later used in the complexity analysis.
Lemma 6.1 
Let p 1 , p 2 R 2 B such that p 1 p 2 , then for t 0 , 1
M t p 1 , B M t p 2 , B = ϕ .
Proof. 
Assume to the contrary that there exists a point p in M t p 1 , B M t p 2 , B , then there exist s i Π B p i , i = 1 , 2 such that
p = t p 1 + 1 t s 1 = t p 2 + 1 t s 2 .
From above equality we conclude that s 1 s 2 . Without loss of generality assume, that
p s 2 p s 1 .
Recall, by definition, that
p 1 s 2 p 1 s 1 .
Since p 1 p 2 and s 1 s 2 , (6.2) implies p 1 , s 1 p 2 , s 2 = p . Thus by (6.3), p 1 s 2 < p 1 s 1 in contradiction to (6.4).
An immediate consequence of Lemma 6.1 is
Corollary 6.2 
Let p M t A B , B , then there is a unique point q A B , denoted by q = G ( p ) , such that p M t q , B . Moreover simple geometric arguments imply that for p 1 , p 2 M t A B , B , G p 1 G p 2 1 t p 1 p 2 .
Since any two metric faces contained in the same polygon have disjoint interiors, we conclude from the above lemma,
Corollary 6.3 
Let F 1 , F 2 be metric faces such that F 1 , F 2 A , then M t F 1 , S F 1 and M t F 2 , S F 2 have disjoint interiors.
Next we prove a result complementing Lemma 6.1.
Lemma 6.4 
Let p 1 A B , p 2 B A . If
M t p 1 , B M 1 t p 2 , A ϕ ,
then
p 1 Π A p 2 and p 2 Π B p 1 .
Proof. 
Let p M t p 1 , B M t p 2 , A , then there exist points s 1 Π B p 1 and s 2 Π A p 2 such that
p = t p 1 + 1 t s 1 = ( 1 t ) p 2 + t s 2 .
Without loss of generality assume that
p 2 s 2 p 1 s 1 .
By definition,
p 1 s 1 p 1 p 2 .
By (6.5) and (6.6),
p p 2 p s 1 .
We prove the lemma by contradiction. Suppose p 1 s 2 , then by (6.5) p 2 s 1 . Thus p 1 , s 1 p 2 , s 2 = p , and therefore by (6.8) p 1 p 2 < p 1 s 1 , which is a contradiction to (6.7).
Note that under the conditions of Lemma 6.4, p 1 A and p 2 B , and therefore we get, in view of Corollary 6.2, that
Corollary 6.5 
The sets A B , M t A B , B , M 1 t B A , A have pairwise disjoint interiors.
Next we discuss the combinatorial complexity of the metric average of two simple polygons. The discussion is based on the notion of the combinatorial complexity of a planar arrangement, which is the sum of the number of vertices, the number of edges, and the number of faces in the arrangement.
Proposition 6.6 
Let n be the sum of the numbers of vertices in A and in B. The combinatorial complexity of A t B with t 0 , 1 is O n 2 .
Proof. 
The combinatorial complexity of A B is O n 2 and the combinatorial complexity of V D B is O n [8]. Since the metric faces in M F B A B are partial to the overlay of the arrangements representing V D B , A and B their total combinatorial complexity is O n 2 and the same bound holds for the metric faces in M F A B A . By Corollaries 6.3 and 6.5, (6.1) is a union of sets with pairwise disjoint interiors. So the combinatorial complexity of A t B is bounded by the combinatorial complexity of A B and the combinatorial complexity of the metric faces, namely it is O n 2 .
Finally we derive the run-time complexity of our algorithm.
Proposition 6.7 
Let n be the sum of the numbers of vertices in A and in B. Let k be the combinatorial complexity of the overlay of the arrangements representing A , B , V D A and V D B . Then the run-time complexity of the computation of the metric average A t B is O n + k log n .
Proof. 
It follows from the proof of Proposition 6.6 that k is O n 2 . Computation of the sets A B , A B , B A can be done in O n + k log n and the combinatorial complexity of each of these sets is bounded by k [15]. The segment Voronoi diagrams V D A and V D B can be computed in O n log n [8]. Since the metric faces in M F B A B are computed by the overlay of the arrangements representing A B and V D B , with the combinatorial complexity of the result bounded by k, they can be found in O n + k log n . Computation of M t F , S F for all metric faces in M F B A B is performed in O k . The same bounds hold for metric faces in M F A B A . Finally we compute A t B as in (6.1). By the proof of Proposition 6.6 the combinatorial complexity of A t B is O k , so the corresponding arrangement can be computed in O n + k log n [9,15].

7. Conclusions

In this work we present an algorithm for the computation of the metric average of 2D sets with piecewise linear boundaries. Our algorithm provides a computational method for the approximation of set valued functions with images in R 2 from a finite number of samples, by techniques based on the metric average [3,4,5].
Although the metric average of 2D sets is defined by operations on each point in the two operand sets, our algorithm reduces the computation to manipulation of 1D objects. This is achieved using segment Voronoi diagrams and planar arrangements. The implementation of the algorithm uses the relevant geometric algorithms in the CGAL [10] library.
The main idea of our algorithm, namely the simplification of the computation of the metric average with Voronoi diagrams has straightforward extension to any two objects in any finite dimension, such that the Voronoi diagrams of the boundaries of the two objects are well defined. A natural extension of this work is to develop and implement an algorithm for the computation of the metric average of two polyhedra.
Whereas the metric average is of interest in applications where the Hausdorff distance is important, it does not possess good geometric properties, as is indicated by the examples in Section 5. For geometric applications, it is of interest to develop set averaging operations that possess good geometric properties, i.e. comprise a gradual transformation of the geometric shape between the two sets, and also have the “metric property” relative to some metric. The first two authors have recently developed a new set averaging operation with good geometric features, having the “metric property” relative to the measure of the symmetric difference of two sets [16].

References

  1. Vitale, R. Approximation of convex set-valued functions. J. Approx. Theor. 1979, 26, 301–316. [Google Scholar] [CrossRef]
  2. Dyn, N.; Farkhi, E. Set-valued approximations with Minkowski averages–convergence and convexification rates. Numer. Func. Anal. Optimiz. 2005, 25, 363–377. [Google Scholar] [CrossRef]
  3. Artstein, Z. Piecewise linear approximations of set-valued maps. J. Approx. Theor. 1989, 56, 41–47. [Google Scholar] [CrossRef]
  4. Dyn, N.; Farkhi, E. Spline subdivision schemes for compact sets with metric averages. Trends Approx. Theor. 2001, 95–104. [Google Scholar]
  5. Dyn, N.; Mokhov, A. Approximations of set-valued functions based on the metric average. Rend. Mat. 2006, 26, 249–266. [Google Scholar]
  6. Baier, R.; Dyn, N.; Farkhi, E. Metric averages of one dimensional compact sets. In Approximation Theory X; Chui, C., Schumaker, L.L., Stoeckler, J., Eds.; Vanderbilt Univ. Press: Nashville, TN, USA, 2002; pp. 9–22. [Google Scholar]
  7. Lipovetsky, E.; Dyn, N. An efficient algorithm for the computation of the metric average of two intersecting convex polygons, with application to morphing. Adv. Comput. Math. 2007, 26, 269–282. [Google Scholar] [CrossRef]
  8. Okabe, A.; Boots, B.; Sugihara, K.; Tessellations, S. Concepts and Applications of Voronoi Diagrams; John Wiley & Sons: New York, NY, USA, 1992. [Google Scholar]
  9. Halperin, D. Arrangements. In Handbook of Discrete and Computational Geometry; CRC Press LLC: Boca Raton, FL, USA, 2004; pp. 529–562. [Google Scholar]
  10. CGAL, Computational Geometry Algorithms Library. Available online: http://www.cgal.org (accessed on 20 July 2010).
  11. Aurenhammer, F.; Klein, R. Voronoi Diagrams. In Handbook of Computational Geometry; North Holland: Amsterdam, The Netherlands, 2000; Chapter V; pp. 201–290. [Google Scholar]
  12. Wein, R.; Fogel, E.; Zukerman, B.; Halperin, D. 2D Arrangements. In CGAL User and Reference Manual; 2010; Available online: http://www.cgal.org/Manual/3.6/doc_html/cgal_manual/packages.html#Pkg:A%rrangement2 (accessed on 20 July 2010).
  13. Karavelas, M. 2D Voronoi Diagram Adaptor. In CGAL User and Reference Manual; 2010; Available online: http://www.cgal.org/Manual/3.6/doc_html/cgal_manual/packages.html#Pkg:VoronoiDiagramAdaptor2 (accessed on 20 July 2010).
  14. Fogel, E.; Wein, R.; Zukerman, B.; Halperin, D. 2D Regularized Boolean Set-Operations. In CGAL User and Reference Manual; 2010; Available online: http://www.cgal.org/Manual/3.6/doc_html/cgal_manual/packages.html#Pkg:BooleanSetOperations2 (accessed on 20 July 2010).
  15. De Berg, M.; Cheong, O.; Van Kreveld, M.; Overmars, M. Computational Geometry: Algorithms and Applications; Springer-Verlag: New York, NY, USA, 2008. [Google Scholar]
  16. Dyn, N.; Kels, S. The four-point subdivision scheme adapted to sets. In preparation.

Share and Cite

MDPI and ACS Style

Kels, S.; Dyn, N.; Lipovetsky, E. Computation of the Metric Average of 2D Sets with Piecewise Linear Boundaries. Algorithms 2010, 3, 265-275. https://doi.org/10.3390/a3030265

AMA Style

Kels S, Dyn N, Lipovetsky E. Computation of the Metric Average of 2D Sets with Piecewise Linear Boundaries. Algorithms. 2010; 3(3):265-275. https://doi.org/10.3390/a3030265

Chicago/Turabian Style

Kels, Shay, Nira Dyn, and Evgeny Lipovetsky. 2010. "Computation of the Metric Average of 2D Sets with Piecewise Linear Boundaries" Algorithms 3, no. 3: 265-275. https://doi.org/10.3390/a3030265

Article Metrics

Back to TopTop