Rotating jamming case -- maximum distance between convex polygon

Source: Internet
Author: User
Maximum Distance between convex polygon

Given two Convex PolygonPAndQTo find the point (P,Q)(PBelongPAndQBelongQ) To maximize the distance between them.

Intuitively, these points cannot belong to the interior of their respective polygon. This condition is actually very similar to the diameter problem:

Two convex polygonPAndQThe maximum distance is determined by the pair of distance points between polygon.
Although the statement is the same, this definition is different from the given Convex Polygon's pair.
Essentially, the difference between a vertex and a convex polygon is that the tangent is backward and backward. An example is shown:
 
The above conclusion implies that not only vertex pairs need to be checked, but only specific vertex pairs need to be considered. In fact, they only detect oneAlgorithmThe established parallel tangent.
Consider the following algorithms:MAndNConvex polygon with clockwise given verticesPAndQ.

    1. ComputingPUpperYVertex with the smallest coordinate value (calledYminp) AndQUpperYThe vertex with the largest coordinate value (calledYmaxq).
    2. For a polygon inYminpAndYmaxqConstruct two tangent linesLpAndSCSIPlace the corresponding polygon on their right side. In this caseLpAndSCSIHas different directions, andYminpAndYmaxqIt becomes a pair of vertex points between polygon.
    3. Calculation distance (Yminp,YmaxqAnd maintain it as the current maximum value.
    4. Rotate parallel lines clockwise at the same time until one of them overlaps with the edges of the polygon.
    5. A new pair of vertex points is generated. Calculate the new distance, which is compared with the current maximum value. If it is greater than the current maximum value, it is updated. If the two lines overlap with the edge at the same time, a total of three pair of vertex points (the combination of the previous vertex and the new vertex) need to be taken into account.
    6. Repeat steps 4 and 5 until the new point is (Yminp,Ymaxq).
    7. Maximum output distance.

The rotating jamming mode ensures that all pair of signature points are taken into account. In addition, the entire algorithm has linear time complexity because (except initialization) the number of execution steps is the same as the number of vertices.

Similar algorithms can be used in the problem of minimum distance between convex polygon.

 

Http://cgm.cs.mcgill.ca /~ Orm/maxd2p.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.