Rotating jamming case -- merge convex hull

Source: Internet
Author: User
Merge convex hull

Consider the following question: what is the Minimum Convex Polygon that contains two convex polygon? The answer is the convex polygon obtained after the convex hull is merged.

The merge convex hull can be implemented in an inefficient way: all vertices of two polygon are given and the convex hull corresponding to these points is calculated. A more efficient method exists. It depends onBridge. Describes this concept:

Two non-Intersecting convex polygon. The merged convex hull contains the convex hull chains (blue thick line on the way) in two polygon, which are connected through the bridge between polygon (blue dotted line on the way)


Given two non-Intersecting polygon, there are two bridges between the polygon. A polygon has the same number of bridges as the number of vertices, as shown in:

Two Intersecting convex polygon. The merge convex hull only contains the bridge between polygon (as shown in the dotted line ). There are eight bridges connected to eight vertices.


The core of merge operations is the sub-governance method. It is also used in polygon. A very simple way to obtain a convex packet is to divide the point set into two parts, calculate the convex packets of two smaller sets, and merge them. Each set is split again until the number of elements is small enough (for example, three or fewer), so the convex hull can be easily obtained.
Toussaint proposed to use the rotating jamming case to find the bridge between two convex polygon. The main advantage of this method is that it uses backtracking and polygon can overlap (OtherAlgorithmThe polygon must be non-Intersecting ). The following is the main process of his algorithm:
Given Convex PolygonP= {P(1 ),...,P(M)} AndQ= {Q(1 ),...,Q(N)}, A point (P(I),Q(J) FormPAndQWhen and only when:

    1. (P(I),Q(J) To form a parallel vertex.
    2. P(I-1 ),P(I+ 1 ),Q(J-1 ),Q(J+ 1) All are located (P(I),Q(J) The same side of the line.

Assuming that the polygon is given in the standard form and the vertices are arranged in clockwise order, the algorithm is as follows:

    1. Separate CalculationPAndQMaximumYCoordinates. If more than one such vertex existsXThe largest coordinate.
    2. Construct the flat tangent of these points, and place the polygon in the positive direction on the right (so they pointXIn the positive direction of the axis ).
    3. At the same time, rotate the two tangent clockwise until one of them is at the intersection of the edge. Get a new merge vertex (P(I),Q(J)). In the case of a parallel edge, three parallel vertex are obtained.
    4. For all valid parallel vertex (P(I),Q(J): DeterminesP(I-1 ),P(I+ 1 ),Q(J-1 ),Q(J+ 1) are all at the connection point (P(I),Q(J) To form the same side of the line. If yes, this parallel point forms a bridge and marks it.
    5. Repeat steps 3 and 4 until the tangent returns to their original position.
    6. All possible bridges have been confirmed at this time. The merged convex hull is constructed by continuously connecting the corresponding convex hull chains between bridges.

The above conclusions confirm the correctness of the algorithm. The running time is subject to steps 1, 5, and 6. They allO (N)Run Time (NIs the total number of vertices ). Therefore, the algorithm has the current time complexity.

The bridge between a convex polygon actually determines another useful concept: the public tangent between polygon. Bridge is also the core algorithm for calculating Convex Polygon intersection.

Http://cgm.cs.mcgill.ca /~ Orm/mergech.html

Please indicate the source for reprinting. Thank you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.