2. Literature Review
Convex decomposition has been used in a wide range of application domains in which complex geometric structures must be simplified to enable efficient computation. In topographic and urban modeling, for instance, building footprints extracted from 3D city models are decomposed into simpler convex components to facilitate visualization, spatial indexing, and automatic pattern extraction [
2]. When converting 3D structures into 2D representations, these footprints are typically partitioned into rectangles or convex polygons that preserve the essential geometric relationships among buildings. Such decompositions also support pattern recognition tasks on large-scale maps, where individual structures are subdivided into smaller convex elements to identify linear or repetitive spatial arrangements. Special attention must be paid to hollow or courtyard-type buildings, since inadequate decomposition may distort internal spaces or introduce artificial gaps. Methods that preserve the topology of polygons with interior holes are therefore crucial for accurate analysis in these applications.
Convex objects have the additional advantage that they can be represented either explicitly or implicitly. An explicit representation usually consists of a polygonal or polyhedral mesh derived from the vertices of the convex hull, whereas an implicit representation characterizes the object as a set of geometric or spatial constraints. In machine learning, neural networks are increasingly used to approximate or compute convex hulls, making implicit representations particularly attractive because they abstract away the underlying geometric topology [
8]. This abstraction allows learning algorithms to focus on constraint satisfaction and structural relationships rather than on the combinatorial complexity of the polygon itself, which can improve robustness and generalization in high-dimensional geometric tasks.
Convex decomposition is also widely employed in pattern recognition, especially in applications where geometric segmentation is essential to extract meaningful features. For example, gesture classification systems often rely on convex decomposition to isolate the hand and individual fingers from a gesture image. By exploiting the approximately convex silhouette of the hand, the shape is partitioned into convex components corresponding to the palm and each finger [
9]. This segmentation enables the extraction of features such as finger count, orientation, relative position, and movement trajectory, which are then used to classify gestures more accurately.
Another classical application of convex decomposition arises in packing and nesting problems, whose objective is to place a set of parts inside a container while minimizing unused space. This situation occurs in industries such as clothing, furniture, and glass manufacturing, where the pieces to be packed often have highly irregular shapes [
13]. To reduce material waste and improve packing efficiency, these shapes are first decomposed into convex components that can be more easily manipulated, rotated, and arranged inside the container [
14]. Effective packing configurations depend on evaluating the orientation and placement of each convex piece, making decomposition a fundamental preprocessing step in most optimization-based packing models [
15]. The performance of convex decomposition algorithms in this context is commonly assessed through two main indicators: the computational cost (e.g., running time or algorithmic complexity) and the number of convex pieces produced, which directly affects packing quality and resource utilization [
16].
From an algorithmic standpoint, several exact methods have been proposed for convex decomposition. Keil [
4] introduced one of the earliest dynamic-programming approaches. His method begins by triangulating the polygon and then progressively eliminates unnecessary diagonals as larger subpolygons are evaluated. At each stage, the algorithm considers combinations of adjacent regions and retains the best decomposition found so far, effectively propagating optimal partial solutions toward the full polygon. The evaluation of contiguous regions determines whether the triangle associated with one subdivision can be merged with the neighboring portion of the polygon, thereby reducing the total number of convex components. This iterative refinement mechanism provides an exact solution for simple polygons and lays the foundation for many subsequent methods in convex decomposition. Earlier work by Schachter [
7] also addressed the decomposition of polygons into convex sets, emphasizing algorithmic and implementation aspects.
A different exact strategy was proposed by Fernández et al. [
10], who developed an algorithm that traverses the polygon’s vertices in clockwise order. Starting from an initial vertex, the method evaluates consecutive vertices to determine whether each internal angle (the so-called aggregates) is less than or equal to 180 degrees. When this condition holds, the vertex is added to a list
that defines a candidate cutting region. The algorithm verifies that the resulting cut does not coincide with the full polygon, thus ensuring that a genuine decomposition is produced. Using the list of concave vertices, the method computes the minimum bounding rectangle that contains all vertices of the candidate cut. If a reflex angle remains inside this rectangle, the cut is reduced to a single vertex and reevaluated; the process is repeated until no concave angles are present and a valid convex subpolygon can be extracted.
Fernández et al. [
10] also introduced a vector-dependency procedure that identifies decompositions of minimum cardinality by comparing each candidate decomposition with known bounds on the cardinality of optimal solutions. In addition, they incorporate a combination phase that searches for essential lines, defined as lines whose removal would revert the resulting region to a non-convex polygon. The three algorithmic components—cutting, dependency evaluation, and combination—are integrated to iteratively refine the decomposition. The performance of the algorithm is assessed through bounds on diagonal-based partitions and tested on benchmark instances with between 50 and 150 vertices.
Several related contributions exploit convex decomposition in auxiliary computational tasks. Li et al. [
17] introduced an efficient algorithm for point-in-polygon queries that first decomposes the polygon into a collection of convex subpolygons and then organizes these regions within a BSP tree. With this structure, the inclusion test is reduced to two logarithmic-time steps, achieving a query time of
and a storage complexity of
while remaining robust to numerical singularities. Adjiashvili and Peleg [
18] proposed a decomposition technique in which convex regions are generated around a predefined set of locations. The polygon is partitioned so that each convex piece is associated with one of these locations, providing a flexible framework for applications that require localized geometric processing.
Other works explore the combinatorial structure underlying polygon partitions. Stanimirović et al. [
19] studied expressions involving Catalan numbers and developed an algorithm for generating triangulations of convex polygons, implemented in Java. Their results highlight the tight connection between Catalan number decompositions and polygon triangulations. More recently, Wzorek et al. [
20] examined the problem of partitioning a polygon into a set of connected, disjoint subpolygons that satisfy given area constraints. Motivated by multi-robot terrain coverage, their formulation incorporates additional requirements such as compactness and balance among the areas assigned to different robots. This line of research illustrates how polygon decomposition techniques continue to support modern robotic applications, where spatial partitioning enables efficient planning and task allocation.
Approximate and heuristic methods have also been proposed for convex decomposition, particularly when exact solutions become computationally expensive. Li et al. [
21] presented an approach in which a simply connected concave polygon is first decomposed using mutual point visibility, a key property of convex regions. They then extend this idea to multiply connected concave polygons by introducing a decomposition algorithm governed by visibility-based stopping rules that prevent overlap among the generated pieces. To identify favorable traversal paths across the connected regions, the method employs an artificial bee colony metaheuristic, which guides the search through the decomposition space. The performance of the proposed approach is evaluated through simulations and compared with the Fast Scan Random Tree Star algorithm, showing the benefits of combining visibility rules with bio-inspired optimization techniques.
Approximate convex decomposition has also been applied to linear pattern recognition problems, particularly in urban analysis where building footprints exhibit collinearity, proximity, or continuity. Wei et al. [
2] propose an approach that combines convex decomposition with the detection of linear spatial patterns in topographical maps. Their method introduces new concave nodes derived from the external structure of the polygon, enabling decompositions for buildings with or without internal gaps while preserving topological consistency. Two rules guide the selection of cuts. The least-component rule evaluates how much a potential cut reduces the number of concave vertices and selects the cut that achieves the largest reduction. The shortcut rule prioritizes cuts with the fewest sides (or minimal length) and is applied only when candidate cuts yield similar reductions in concavity. Additional constraints ensure realistic modeling of urban structures, such as preventing the decomposition of a building if an adjacent one has already been processed. Priority is given to polygons with higher structural complexity, defined by the number of edges, so that the method first focuses on the most intricate building shapes. This approach demonstrates how convex decomposition can support geometric pattern extraction in large-scale spatial datasets.
Lien and Amato [
3] proposed an approximate convex decomposition framework capable of processing polygons with holes, a setting that substantially increases geometric and topological complexity. Their method focuses on generating regions that are approximately convex and well suited for motion-planning applications, where strict convexity is less critical than preserving navigable free space. However, their objective differs from the goal of the present work: they do not aim to minimize the number of convex components produced by the decomposition, and thus they do not address the optimal convex decomposition problem nor the evaluation of exact and heuristic strategies under a minimum-cardinality criterion. This distinction highlights a gap in the literature that motivates the development of the methods presented in this paper.
A general limitation in the convex decomposition literature is the absence of standardized benchmark instances, which complicates fair comparisons and rigorous assessments of competing methods. Many studies evaluate their algorithms on different datasets, preventing direct performance analysis across approaches. At the same time, this limitation offers an opportunity: by consolidating instances from multiple sources, future research can establish common evaluation frameworks and promote methodological consistency. In this spirit, our work incorporates the benchmark instances of Fernández et al. [
10] and addresses the lack of datasets for polygons with holes by introducing a new publicly available collection of holed instances. We also present the first computational results for these instances, thereby enabling reproducible and comparable analyses on a broader and more complex class of convex decomposition problems.
3. Methodology
In this work, we propose an algorithmic framework for decomposing a nonconvex two-dimensional polygon into the smallest possible number of convex subpolygons and subsequently applying a union phase to further reduce the final count of convex pieces. Such decompositions are valuable in applications involving pattern recognition, packing and nesting optimization, and neural-network–based geometric processing. Although techniques such as the Minkowski sum and triangulation are commonly used in related geometric tasks, these approaches do not guarantee a minimum convex decomposition. Fernández et al. [
10] compared several classical algorithms and identified the most effective in terms of the number of pieces obtained; however, their method does not incorporate the structural advantages of Keil’s exact approach. For this reason, and motivated by its dynamic-programming foundation, we build upon the exact methodology introduced by [
4], integrating several adaptations that enhance its applicability and performance. The resulting procedure, together with the heuristic and union components described later, constitutes the methodological basis of this study.
First, we apply an exact convex decomposition method inspired by the algorithm of [
4], which provides a baseline for comparison with our heuristic approach. This exact procedure recursively subdivides the polygon into triangles and subpolygons, evaluating candidate merges to obtain the smallest possible number of convex components. Based on this reference, we then develop a heuristic algorithm that approximates the decomposition by identifying and linking notches, selecting initial vertices with a high number of visible neighbors, and exploring three-vertex configurations to generate valid cuts and combine adjacent regions. Finally, we incorporate a convex-part union procedure that merges compatible subpolygons after the initial decomposition. This post-processing step is applied to both the exact and heuristic outputs, allowing for a consistent comparison of their effectiveness in reducing the total number of convex pieces.
To implement the exact algorithm, we take the method of [
4] as the foundational framework, incorporating several modifications to adapt it to the problem addressed in this work. Two core concepts are essential for this algorithm: visibility and reference vertices. Visibility refers to the ability to connect two points with a straight segment that remains entirely inside the polygon and does not intersect any of its edges, except at its endpoints [
4]. Reference vertices, in turn, include all concave (reflex) vertices as well as the initial and final vertices of the polygon’s boundary traversal. As illustrated in
Figure 2, the two points on the left are mutually visible because the segment joining them satisfies all geometric admissibility conditions imposed by the polygon. By contrast, the two points on the right are not visible, as any connecting segment would either exit the polygon or intersect one of its edges, making it infeasible according to the established criteria.
Each polygon instance presents distinct characteristics, such as the number of concave (reflex) vertices and the lengths of its edges. The input data are provided in a text file that lists the vertex coordinates in clockwise order, starting from vertex 0. Once the coordinates are read, the geometric properties of the polygon are computed, including the set of edges and internal angles, to determine whether the polygon is convex or nonconvex. These preliminary computations form the basis for the subsequent decomposition process. The main steps of this procedure are summarized in Algorithm 1.
| Algorithm 1. Exact convex decomposition |
Input coordinates of the vertices of the part (ListP) Output coordinates of the vertices of the convex parts
- 1.
Angles ← GetAngles (ListP) - 2.
V ← Determine PointsNotches (Angles) - 3.
Subp ← Determine Visibility (V) - 4.
Subp ← Order Subp - 5.
T ← DeterminatingTriangles (Subp) - 6.
ListM ← List (n, | T |) - 7.
ListDes ← List (Empty, | T |) - 8.
For each t in T - 9.
- 10.
- 11.
- 12.
- 13.
then: - 14.
ListUn Delete - 15.
ListDes.Add ) - 16.
- 17.
then: - 18.
ListDes.Add ) - 19.
Return ListDes
|
In line 1 of the Algorithm 1, the angles of the original figure P are obtained. Then, in line 2, a list is determined that contains the vertices of said figure that are notches or concave angles. In line 3, we proceed to find the visibility of the vertices, considering that for those vertices that are reference points (notch, or ), all vertices must be evaluated to determine which ones are visible from that point. On the other hand, for vertices that are less than or equal to 180°, only the reference vertices are considered for visibility, so the visibility of a point whose angle is not concave to another would not be found unless one of the two is a reference vertex because it is the beginning or end of the original figure. A list is obtained with the vertices that can be seen from each point of the figure. The visibility procedure is explained in Algorithm 2; however, in Algorithm 1, it is taken into account that if the points in which the visibility is evaluated, and are collinear and there are points on the line formed by them, and cannot be seen. Because of this, it would be a modified visibility. Now, this possible union of visible vertices corresponds to the base side of a valid subpolygon. For a subpolygon to be valid, its starting point or its end point , or both, must be concave angles (notches). The base side is the side whose ends correspond to the vertices that mark the beginning and end of the figure; therefore, a subpolygon will be defined by , where i < j. In this way, unions of vertices that are not notches are prevented from occurring unless they are contiguous. With this in mind, we proceed to make a list of the base sides of a valid subpolygon, or what is equivalent to making the union of those vertices that can be seen, excluding visibility because they are contiguous.
Next, in line 4, a comparison is made between the starting and ending points of each side of the previously mentioned valid subpolygons to determine how many vertices each one will cover. This list is organized by making the difference between the final and initial vertices () of each subpolygon. This list is ordered in ascending order by this difference. If the difference is 2, it is because the subpolygon is a triangle, so it is saved as the convex decomposition.
In line 5, we proceed to find the base triangles of each subpolygon. A base triangle named
is the one in which
and its sides
and
are sides of the original polygon or are base sides of a valid subpolygon. Additionally, as observed according to the nomenclature, one of the sides must be the base side of the subpolygon in question. For this reason, depending on the number of vertices of the subpolygon and the shape of the original figure, a subpolygon would have one or more base triangles. This procedure is performed by evaluating the base side of the subpolygon with its different vertices and looking for the combinations
and
in the list of base sides of subpolygons found earlier. In
Figure 3, on the left is an example of a base triangle, and on the right, a triangle that is not a base for a subpolygon
.
From this point, the following steps cause the minimum convex decomposition to be generated; this procedure has a complexity of . “ListM” is denoted as a list that contains the sizes of the decompositions of each subpolygon. On the other hand, “ListDes” will store the information of the minimum convex decomposition that is found as it is iterated. This is found on lines 6 and 7, respectively.
Next, we proceed to work with a dynamic programming algorithm that allows us to tackle this problem by means of small subproblems that are solved only once, and its information is stored to avoid repetitive iterations. Working with the triangle , the decomposition for the polygon is sought as , as presented in line 10. represents the union of the triangle in question and the decomposition . If the union cannot be given, go to the next step (line 12) carrying the triangle and . Otherwise, the union is made.
Similarly, working with the triangle , the decomposition for the polygon is sought . They should be joined, if possible. represents the union of the triangle in question and the decomposition .
If the size of decomposition is smaller than the size of the previous decomposition, we must delete what was in “ListDes”; this new decomposition is stored as , and M is updated as the size of the new decomposition. Otherwise, it must be evaluated if they are equal so that this decomposition is stored as .
The evaluation process for the union between the triangles and the convex parts of the decompositions that are obtained is carried out by means of a function that stores the convex decomposition of a polygon .
In
Figure 4, an example of a nonconvex figure is observed. After the visibility procedure and determining the valid subpolygons, the first subpolygon whose difference between the initial and final vertex is not 2 is taken (
Figure 4a). In this case, it would be 0–3, so we proceed to find the base triangles, which can be seen in
Figure 4b. With these, we proceed to evaluate whether they can be joined with the respective convex part. The first triangle is taken, which would be
, and the polygon decomposition is evaluated as
, which would not exist because they are continuous. Next, the polygon is taken as
, which already has a convex decomposition, which would be the triangle
, which is why it is evaluated if
can be joined with
(see
Figure 4c), observing that it is possible because they form a convex figure (see
Figure 4d); thus, when making the union, the convex decomposition that would be obtained from 0 to 3 would be 1 single figure, as observed in
Figure 4d.
Thus far, what differentiates the algorithm of this article from that of [
4] is that he evaluates the angles and takes the polygon to be joined with the triangle as the one with the smallest angle. This is not necessary if you evaluate it and store the information in the correct order so that the first position of the decomposition is always the closest polygon with which the triangle of the contiguous subpolygon can possibly be joined.
| Algorithm 2. Visibility between points |
Input coordinates of the vertices of the figure (ListP) Output list of points visible to each other
- 1.
Angles ← GetAngles (ListP) - 2.
VList ← GetConcaveAnglesandVertices (Angles) - 3.
ListN, ListRec ← GetConcaveAngles (Angles), GetLines (ListV) - 4.
For k ← 1 up to Size (P): - 5.
PDesde ← P [k] - 6.
For y ← k + 2 up to Size (P): - 7.
PHasta ← P [y] - 8.
If v1v2 (PDesde, PHasta) and v1v2 (PHasta, PDesde) then: - 9.
If they are linear (PDesde, PHasta) then: - 10.
PRecta ← GetPointsInStraight (Straight (PDesde, PHasta)): - 11.
If Size (PRecta) > 0: - 12.
For m ← 1 up to Size (PRecta) then: - 13.
If v1v2 (PDesde, PRecta [m]) and v1v2 (PHasta, PRecta [m + 1]) then: - 14.
C ← C + 1 - 15.
If C = Size (PRecta) then: - 16.
If Intersection (ListRec, Line (PDesde, PHasta)) = False then: - 17.
ListaVisi ← PDesde, PHasta - 18.
Return ListaVisi
|
Algorithm 2 shows the procedure to find the visibility between the points of a figure. In lines 1, 2 and 3, the angles of the figure are found, the list of concave angles and vertices is obtained, and a list is created containing those vertices that are notches. In the same way, the list of equations of the lines that make up the figure is obtained. We proceed to make a cycle that goes to the number of vertices that the figure P has to check the points visible from that point. The first point in figure P is taken as the first point from which the visibility of the other points is to be evaluated so that the visibility of the points following this point is tested without counting the point immediately after because it is already visible; thus, in line 6, the counter starts at k + 2.
Another tour is made to evaluate whether the other points of the figure are visible from the point in question taken on line 5 of Algorithm 2. The point to be evaluated is defined, which is called “PHasta” and is found on line 7. There is a function that determines the position of a point with respect to the lines that form another point, which is called “v1v2”. As seen in line 8, the function is first evaluated in the first parameter “PDesde”, which means that from this point, the lines that form it are taken, and the position of the vertex “PHasta” with respect to these lines is evaluated. If the first parameter of the function is a notch and the positions of “PHasta” with respect to line 1 and line 2 are to the left in both cases, then visibility between the points is not possible. If it is not notch, if one of the positions indicates that it is to the left, the visibility cannot be given either; Otherwise, it would be given. In line 8, the same function is also evaluated but having as the first parameter “PHasta” and as the second parameter “PDesde”, which indicates that now the lines that make up “PHasta” and the position of “PDesde” are evaluated considering the same considerations mentioned above. In
Figure 5, the image on the left shows two points
A and
B that are visible with the “v1v2” function, while in the image on the right two points
A and
B are shown that are not visible by this function. If the position of
B is observed with respect to lines R1 and R2 (generated by
A), if it is to the left and
A is a notch in both cases, the visibility between the points would not be given.
Then, in line 9, it is evaluated if the points are collinear; for this, the function “SonColineales” is used, which evaluates if the points belong to the same line. The vertices of the figure that belong to that line are obtained without counting the points that generate it, that is, “PDesde” and “PHasta”, as shown in line 10. If this generated list contains points, we proceed to evaluate each of its elements. All the elements of the line are traversed, and the function “v1v2” is evaluated with the points “PDesde” and “PHasta”. If it is possible for the points to be seen with this check, a counter is increased. This process can be seen in lines 13 and 14, respectively. If it is true that all points are visible, we proceed to the last evaluation, which is on line 16. This is to check that the line generated by “PDesde” and “PHasta” does not intersect with any line in the original figure. If all the conditions are met, the information about the vertices in question is saved in a list called “ListaVisi”.
Similarly, a heuristic algorithm is developed to obtain an approximate decomposition of the nonconvex polygon, drawing partially on the method proposed by [
10]. The input consists of a file containing the coordinates of the polygon’s vertices. As in the exact approach, the geometric properties of the polygon are first computed, including the equations of its edges and the internal angles at each vertex. In contrast to the exact algorithm, however, the vertices are enumerated and processed in counterclockwise order, which simplifies the identification of notches and the subsequent construction of candidate cuts. The overall procedure is summarized in Algorithm 3.
The list of notches or concave angles is identified, as shown in line 3. This list is traversed seeking to unite the consecutive notches so that a figure can be formed that is contained in the original figure and that meets the characteristics of convexity. This cycle is shown in lines 4, 5 and 6. If possible, the same is done for the convex union, and the coordinates and angles of the original polygon are reestablished. Otherwise, the next pair of consecutive notches is evaluated, as shown in line 6. The consecutive notches in the list are always evaluated and not the combinations of possible pairs with each element of the list, since if not, they are consecutive because there is a notch between them, which would immediately make the figure nonconvex. In
Figure 6, an example of this is shown.
Once this process is finished, we have a figure with fewer notches than the original. Next, we begin to work with the remaining figure; for this, it is necessary to determine the number of consecutive points close to a specific point that are non-notches (less than or equal to 180), as this would find the point to be cut closer than including the greatest number of nonconcave vertices, ensuring their convexity if the initial and final lines are valid within the subpolygon. For this process, the angles of the figure to be evaluated are taken, along with the list of vertices that are notches of the same. This data will be updated as the figure is divided, as shown in lines 13 and 14.
| Algorithm 3. Approximate convex decomposition |
Input Part vertex coordinates (ListP) Output coordinates of the vertices of the convex parts
- 1.
Angles ← GetAngles (ListP), ListL ← Empty - 2.
ListV ← GetVertices (Angles) - 3.
ListN ← GetConcaveAngles (Angles) - 4.
For i ← 1 up to Size (ListN) - 5.
If ListN [i + 1] <> Next [P, ListN [i]] then: - 6.
P1←ListN[i], P2←ListN[i + 1], start←[P,P1], end←[P,P2] - 7.
ListCreo ← GetFigure (start, end) - 8.
ListCreo.Add ListV [i] - 9.
If IsConvex (ListCreo) then: - 10.
ListL ← ListCreo - 11.
Else: - 12.
Exit - 13.
While Flag: - 14.
Angles ← GetAngles (ListP), ListV = GetVertices (Angles) - 15.
ListN ← GetConcaveAngles (Angles) - 16.
If ListN = Empty or IsConvex (P) then: - 17.
Flag ← False - 18.
ListVec ← GetNumberConcaveNeighbors andVertices (P) - 19.
VerticeInitial ← P.index (Max (ListVec)) - 20.
Figure ← GetFigure (VerticeInitial, ListVec [NeighborVerticeInitial]) - 21.
If IsConvex (Figure) then: - 22.
ListL.Add (Figure), P ← P - ListL, ListV ← GetVertices (Angles) - 23.
For i ← 1 up to Size (ListV): - 24.
v1 ← ListV[i], v2 ← ListV[i + 1], v3← ListV[i + 2], j ← 3 - 25.
ListC(v1,v2,v3) - 26.
While j < Size(ListV) - 27.
If IsConvex (ListC, ListV [i + j]) then: - 28.
ListC.Add (ListV [i + j]), j = j + 1 - 29.
Else if Size(ListC) > = 3 then: - 30.
ListL.Add (Convex (ListC)) - 31.
Exit - 32.
Else: - 33.
ListC.DropLast(), ListC.Add (ListV [i + j]), j ← j + 1 - 34.
For i ← 1 up to Size(ListL): - 35.
For j ← Size(ListL) up to j > i: - 36.
CombineConvex (ListL[i], ListL[j]) - 37.
Return ListL
|
Each point is taken, and the notches closest to said vertex are evaluated, thus identifying the number of non-notch vertices that are covered and the notch point where it will be divided. Next, the point at which the vertex in question would cover more points is found, considering that this figure must be convex; for them, the difference of the positions of the vertices in the original figure is used, as shown in line 19. If this difference is 1, it means that they are consecutive, so this notch is not considered as a possible point to make a figure because only one line would be formed. This procedure is performed for each point in the figure, considering the list of notches, and the number of vertices that are covered, and the closest neighbor are saved in the list (see
Figure 7). In this figure, the points to be joined are shown in green, and the non-notch vertices that they would cover are shown in yellow.
As the figure is cut, the remaining points, their vertices, and the identification of those that are notches, which are lines 13 and 14 at the beginning of the indeterminate cycle, are reestablished. The process stops when the maximum difference is 1 or 0 and continues with another part of the algorithm.
At this point, the structure is made up of elements with and without notches, derived from cuts in the original figure. These notches are placed consecutively or preceded by only one, which is not beneficial for continued iteration. In line 24, a starting point is chosen from the list of vertices of the remaining figure, and the two consecutive vertices are selected for the first evaluation of the iterations; see the red points in
Figure 8. In general terms, the algorithm consists of taking three vertices and verifying if the second of the three selected or the one before the last is a notch, since this would indicate that the figure is not convex. In this case, one of the two methods is used, depending on the specific situation, which will be explained below.
After selecting the first three consecutive angles, if the second of them turns out to be a notch, the starting point is changed by moving it one position forward, and the next three angles are taken again, as shown in line 29.
If the figure passes successfully through this filter, the final vertex continues, keeping the two initials, for the one following the last of the previous iteration. This is based on the premise that if the previous iteration is convex, it is only necessary to change the last point and evaluate the triangle formed. As the end point is modified, the previously mentioned conditions are verified. At this point, it is verified that the angle of the second vertex fulfills the condition of not being a notch. This is evaluated as the end point is changed. In line 29, if the angle before the end point is a notch, it is necessary to cut the figure or divide it at the previous point. In this case, as shown in line 33, we return to the previous point and make the cut from the first vertex to the vertex prior to the one evaluated as final and eliminate these vertices of P. Once the cut is made, we proceed to restructure the remaining figure, and again, the next three vertices are taken.
This algorithm ensures that it will not remain in an infinite cycle in some piece because, at least at some point, it will triangulate it. When we have the cuts, we proceed to evaluate those lines that are not essential for the subpolygons created; an essential line for a polygon is one which, if eliminated from it, the remaining figure is not convex [
10]. This occurs when the cut parts or subpolygons share adjacent sides, so if two figures are united by the same side, but when removing said side in common the figure is not convex, that side is essential for them and to comply with the convexity wanted. All the subpolygons obtained are traversed, as shown in line 34, and it is verified whether other subpolygons on the same side are found. Once they are found, those polygons that share the side are stored. Once we have the list, we proceed to make the possible combinations of these figures, eliminating the nonessential lines of the polygons and obtaining a decrease in the number of convex pieces. This procedure is performed until nonessential lines are found.
Figure 9 displays the solution of the example that has been shown.
Up to this point, the procedure yields a convex decomposition that, although not guaranteed to be optimal due to the heuristic nature of the algorithm, provides solutions that are typically close to optimal and can be computed within a reasonable time.
Because the aim of this post-processing step is to further reduce the number of convex components, both the exact and the heuristic algorithms produce an initial collection of convex pieces that may not be adjacent. The union procedure therefore seeks to merge any two convex subpolygons by examining their boundary vertices, regardless of the number of intermediate pieces between them, provided that the resulting merged region remains convex. This strategy enables the algorithm to explore non-local combinations that would otherwise be missed if only adjacent components were considered.
Once the convex decomposition has been generated, we apply the union procedure (Algorithm 4) to the components produced either by Algorithm 1 or Algorithm 2, as indicated in line 5. It is important to emphasize that unions are performed strictly between two convex pieces at a time, and the resulting merged region must also be convex. No translations or rotations are applied; the two pieces are simply combined by connecting their initial and final boundary vertices. This evaluation is carried out for every pair of components, and the method does not require the pieces to be adjacent in the original decomposition. Instead, each potential union is tested as if the two regions were contiguous. When a valid convex union is identified, the original pieces are removed from the decomposition list and replaced with the newly formed convex region, as described in lines 6–9.
| Algorithm 4. Union of convex parts |
Input List of convex parts ListD Output List of vertices of convex parts after union ListParts- 1.
For i ← 1 up to Size (ListD): - 2.
Di ← ListD [i] - 3.
For j ← i + 1 up to Size (ListD): - 4.
Dj = ListD [j] - 5.
Dj) then: - 6.
Dj - 7.
ListD [i] ← New - 8.
Di ← New - 9.
ListD.Delete (j) - 10.
Return
ListD
|
To determine whether a polygon defined by an ordered list of vertices is convex, we employ the IsConvex function, which checks that all vertices are mutually visible and that the polygon maintains a consistent turning direction. If every vertex satisfies this condition, the polygon is classified as convex. This procedure is used repeatedly in the visibility-based operations of Algorithm 2. Although it is essential for validating each subpolygon, the IsConvex function has inherent numerical limitations. Small floating-point inaccuracies or configurations with nearly collinear vertices may cause borderline cases to be incorrectly labeled as convex or non-convex. To mitigate these effects, we apply numerical tolerances in the evaluation of angles and cross products and enforce a consistent vertex orientation throughout the algorithm. These measures help stabilize the convexity assessment, and in practice, no misclassification affected the correctness of the decompositions produced in our experiments.
The computational complexity of Algorithm 3 would be , where c is the number of convex pieces and represents the i-th convex piece. In other words, complexity is proportional to the square of the number of convex regions multiplied by the average number of vertices per region. This reflects the fact that the algorithm evaluates potential merges across all pairs of convex pieces and must process the geometric information associated with each subpolygon.
Finally, we introduce an adaptation of the proposed heuristic to tackle the decomposition in polygons with holes. The former heuristic procedure described is originally defined for simple polygons. To extend it to polygons with holes, we apply a transformation that converts a holed polygon into an equivalent simple polygon while preserving all geometric relations required by the heuristic. Let denote a polygon with an outer boundary and a set of inner boundaries (holes) {, , …, }. For each hole , a vertex ∈ is selected and connected to a visible vertex . The segment is added as a bridge, and the vertex order of is reversed so that the resulting polygon becomes simple. This ensures that the heuristic—based on vertex ordering, angle detection, notch identification, visibility rules, and valid subpolygon construction—remains applicable without altering its internal mechanisms.
Once the simple polygon is obtained, the heuristic executes exactly as in the original procedure. The angles of are computed, the list of notches is determined, and the initial phase that searches for consecutive notches to form convex subpolygons remains valid. Because the bridging transformation preserves the convexity structure and visibility relations, the procedure for selecting cutting vertices—based on the number of non-notch neighbors—can be applied directly to without additional adjustments.
The final phase of the heuristic, which evaluates essential lines in the generated subpolygons and performs convex unions, also requires no modification. All bridges created in the transformation are treated as standard polygon edges, and the convexity test IsConvex(·) is used to determine whether two adjacent subpolygons can be merged. As a result, the adapted heuristic retains the same computational structure and complexity as the original algorithm while enabling its application to polygons with holes. This extension broadens the scope of the methodology and supports consistent comparisons with the exact approach over a larger class of instances.
4. Computational Experiments and Analysis of Results
The algorithms were implemented in Python 3.9.12 and executed on an Intel
® Core™ i7-4702MQ CPU (Intel Corporation, Santa Clara, CA, USA) with 16 GB of RAM. All scripts developed for this study are publicly available, together with the full set of benchmark instances used in our experiments. The dataset includes both the classical instances introduced by [
10] and the new collection of ten small, holed polygons specifically generated for this work. Providing open access to all source code and test instances ensures full reproducibility and facilitates future comparative research on convex decomposition for both simple and holed polygons.
The benchmark proposed by [
10] consists of 250 simple-polygon instances divided into five vertex groups with |V| ∈ {50, 75, 100, 125, 150}.
Table 1 summarizes the main characteristics of these groups. For each value of |V| (number of vertices), the table reports the distribution of the number of notches, denoted by MIN, AVG, MAX, and SD, where the formers correspond to the minimum, average, and maximum number of notches observed in the group, and SD is the standard deviation across the instances. The last column, NI, indicates the number of instances per group, which is constant and equal to NI = 50 for all values of |V|. As |V| increases, the average number of notches also grows, providing a balanced benchmark that simultaneously controls polygon size and shape complexity.
Figure 10 displays one representative instance from each vertex group, providing an illustrative sense of the geometric complexity present in the benchmark. For each instance, the coordinates of the vertices are stored in plain-text files, where each line contains a vertex and entries are separated by tab characters. This format ensures consistency across all datasets and facilitates direct use of the instances in algorithmic evaluations.
We first compare the modified exact algorithm based on [
4] without the union procedure (Algorithm 1) against the version that incorporates the union of convex pieces (Algorithms 1 and 4).
Table 2 summarizes the results. For each vertex group (|V|), the table reports the average objective function value without union (OF-NU), the corresponding average CPU time in seconds without union (CPU-NU [s]), the average objective function value with union (OF-U), the average CPU time in seconds with union (CPU-U [s]), and the difference in objective values ΔOF = OF-U − OF-NU. As expected for an exact method that already produces a minimal decomposition, the union phase offers little improvement: the mean objective values with and without union are almost identical across all groups. It is also important to note that the running times of both configurations are nearly identical, indicating that the union phase does not introduce meaningful computational overhead.
As noted earlier, some convex pieces cannot be merged because doing so would produce a nonconvex region, as illustrated in
Figure 11. In contrast,
Figure 12 presents an example in which the union of two convex pieces is feasible and effectively reduces the total number of components: the original decomposition in
Figure 12a consists of two convex regions, which can be successfully combined into a single convex polygon, as shown in
Figure 12b,c. These examples are derived from intermediate cuts generated by the exact algorithm and illustrate the conditions under which the union procedure is beneficial.
Table 3 compares the performance of Algorithm 1 (A1, exact without union), Algorithm 2 (A2, approximate without union), and the heuristic of Fernández et al. [
10] (F) across the five groups of instances. For each group, the table reports the number of vertices (
|V|), the average objective function value (OF-), the average CPU time in seconds (CPU-[s]), the average percentage gap in objective values between algorithms A1 and A2 (GAP-OF-A1
), the average percentage gap in CPU time values between algorithms A1 and A2 (GAP-CPU-A1), the average percentage gap in objective values between algorithms A1 and F (GAP-OF-F), and the average percentage gap in CPU time values between algorithms A1 and A2 (GAP-CPU-F). The largest GAP is observed in the instances with 50 vertices, while the smallest occurs in the instances with 150 vertices, suggesting that our approximate method performs comparatively better on larger polygons. Regarding computational time, A2 consistently outperforms F, which can be attributed to the fact that A2 generates larger initial cuts, reducing the number of iterations required during the decomposition process. As expected, A1 yields the best average objective values, since it computes optimal decompositions; however, A2 is significantly faster, primarily because it traverses a smaller search space while remaining close to the optimal number of convex pieces.
Additionally, we compared the performance of the algorithms discussed above, as summarized in
Table 3. This table reports the GAP between the approximate algorithm proposed in this work and the heuristic of [
10], showing that the difference in solution quality does not exceed 7 percent. The largest GAP is observed in the instances with 50 vertices, while the smallest occurs in the instances with 150 vertices, suggesting that our approximate method performs comparatively better on larger polygons. Regarding computational time, Algorithm 2 consistently outperforms the heuristic of [
10]. This improvement can be attributed to the fact that Algorithm 2 generates larger initial cuts, which reduces the number of iterations required during the decomposition process. Although Algorithm 2 cannot outperform the exact method in terms of minimizing the number of convex pieces, it achieves a substantial reduction in computation time. As expected, Algorithm 1 without the union phase yields the best average objective values, since it computes optimal decompositions; however, Algorithm 2 is significantly faster, primarily because it traverses a smaller search space.
In
Table 4, we compare the approximate algorithm (Algorithm 2) without the union procedure against the version incorporating the union of convex pieces. For each vertex group (|V|), the table reports the average objective function value without union (OF-NU), the corresponding average CPU time in seconds without union (CPU-NU [s]), the average objective function value with union (OF-U), the average CPU time in seconds with union (CPU-U [s]), and the difference in objective values ΔOF = OF-U − OF-NU. In this comparison, the effect of the union phase is more pronounced than in the exact algorithm: the largest improvement occurs in the instances with 150 vertices, suggesting that larger polygons provide more opportunities for successful convex merging. This observation is consistent with the results in
Table 3, where the difference between Algorithm 2 and Fernández et al. (2000) [
10] is also highest for the 150-vertex group, indicating a greater presence of mergeable convex regions. Conversely, the smallest improvement from the union procedure is observed in the instances with 50 vertices, which aligns with the smaller differences found when comparing these instances across all algorithms. Together, these results suggest that the union phase is particularly beneficial for larger and more complex polygons.
To evaluate the extension of our methodology to polygons with holes, we generated a new benchmark consisting of ten small instances constructed from regular outer polygons containing regular inner holes. Each instance was designed to preserve geometric clarity while exhibiting meaningful non-convex structure derived from the presence of the inner cavity. The instances vary in total size—from 7 to 17 vertices—and include different combinations of outer and inner vertex counts, allowing controlled variability in complexity while keeping the problems computationally lightweight. All instances were made publicly available together with the coordinates of their vertices, enabling future studies to perform consistent and reproducible comparisons on polygon-with-holes scenarios, a setting for which no standardized datasets currently exist in the convex decomposition literature.
Table 5 summarizes the performance of the proposed method on the newly generated polygon-with-holes instances. For each instance identifier (Id instance), the table reports the number of outer vertices (OV), inner vertices (IV), and total vertices (TV), together with the objective function value (OF) and the CPU time in seconds (CPU [s]). The results indicate that both the objective values and computation times remain extremely small across all cases, with every instance being solved in less than 0.01 s. The number of convex parts obtained matches exactly the structural complexity suggested by the number of notches introduced by the inner cavity, confirming that the bridge-based transformation preserves the decomposition characteristics required by the algorithm. Importantly, none of the instances exhibit performance degradation relative to simple polygons of similar size, showing that the adapted heuristic handles holed topologies efficiently and remains stable even when the inner contour significantly differs in shape from the outer boundary.
Figure 13 illustrates one of the proposed instances with a hole (WithHoles10) together with its optimal decomposition. The outer boundary and the inner cavity produce a non-convex configuration where several concave features arise from the interaction between both contours. After applying bridge-based transformation and the subsequent decomposition steps, the algorithm identifies five convex subpolygons, each respecting the visibility and convexity constraints of the original geometry. The solution in
Figure 13b shows a clean and compact partition, demonstrating that the method not only handles the topological complexity introduced by the hole but also produces geometrically intuitive convex pieces that tightly conform to the structure of the original polygon.