Rotating jamming case -- width of a convex polygon

Source: Internet
Author: User
The width of a convex polygon is defined as the minimum distance between the parallel tangent. This definition has been reflected in the word width. Although the tangent of a convex polygon has different directions, and the width of each direction (usually) is different. Fortunately, not all directions must be detected.

Assume that a line segment [A, B], And twoAAndB. By rotating the lines around these two points, the distance between them increases or decreases progressively. In particular, there is alwaysSpecific Rotation DirectionThe distance between two lines is reduced by rotation.

This simple conclusion can be applied to the width problem: not all directions need to be considered. Assume that a polygon is given, and there are two parallel tangent lines at the same time. If they do not overlap with edges, we can always rotate them to reduce the distance between them. Therefore, the width of the polygon can be determined only when at least one of the two parallel tangent matches the edge.

This means that "vertex-edge" and "Edge-edge" need to be considered during width calculation.

 

Width of a convex polygon. The diameter pair is shown in the black spots that pass by the parallel tangent (red line. The diameter is shown in the highlighted light blue line.


A problem that is very similar to the calculation diameterAlgorithmYou can obtain the vertex-edge and edge-edge pairs by traversing the polygon pair list to calculate the width. The selection process is as follows:

    1. Calculate a polygonYThe endpoint in the direction. We call itYminAndYmax.
    2. PassYminAndYmaxConstruct two horizontal tangent lines. If a (or two) line overlaps with an edge, a "vertex-edge" pair or "Edge-edge" pair has been established. In this case, the distance between the two lines is calculated and saved as the current minimum distance.
    3. Rotate two lines at the same time until one of them overlaps with one side of the polygon.
    4. A new "vertex-edge" pair (or "Edge-edge" pair when both lines overlap with edges) is generated at this time. Calculate the new distance and compare it with the current minimum value. If it is smaller than the current minimum value, it is updated.
    5. Repeat steps 3 and 4 until the initial parallel edge is reached again.
    6. Use the pair of the obtained minimum value as the output of the pair to determine the width.

The more intuitive algorithm is reflected by the introduction of angle computing. However, just like in the maximum distance between convex polygon, sometimes a simpler and more intuitive rotation jamming algorithm must be introduced for calculation.

 

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