Rotating jamming case -- convex polygon minimum perimeter external rectangle

Source: Internet
Author: User
Convex Polygon minimum perimeter external rectangle

This problem is similar to the smallest area external rectangle. Our goal is to find an external polygon in the smallest box (for perimeter ).P.

What is interesting is that the minimum area and the external rectangle of the minimum perimeter usually overlap. Some may wonder if this is always true. The following example answers this question: the polygon (Gray) and its smallest area external rectangle (left side) and the smallest perimeter external rectangle (right side ).


Now, given a direction, we can calculatePTo determine an external rectangle. However, just like in the area problem, since we have the following conclusion, we do not have to detect each State to obtain a rectangle with the smallest perimeter:

Convex PolygonPThe outer rectangle of the minimum perimeter has an edge and a side of the polygon coincide.

This conclusion effectively limits the possible range of a rectangle by enumerating a coincidence edge of a polygon.

 

As shown in the preceding figure, the four tangent lines (red) overlap with the side of the polygon and determine the external rectangle (blue ).


Because it is equivalent to the area problem, this problem can be achieved through a similarAlgorithm.
The input of subordinate algorithms is a convex polygon in clockwise order.NVertex.

    1. Calculate the endpoints of all four polygon.Xminp,Xmaxp,Yminp,Ymaxp.
    2. Constructed by four pointsP. They identified two "shells.
    3. If one or two lines overlap with one side, the area of the rectangle determined by the four lines is calculated and saved as the current minimum value. Otherwise, the current minimum value is defined as Infinity.
    4. Rotate the line clockwise until one of the lines overlaps with one of the sides of the polygon.
    5. Calculates the perimeter of the new rectangle and compares it with the current minimum value. If it is smaller than the current minimum value, it is updated and information about the rectangle that determines the minimum value is saved.
    6. Repeat steps 4 and 5 until the angle of line rotation is greater than 90 degrees.
    7. Output The minimum perimeter of the external rectangle.

Because the two pairs of "shells" determine an external rectangle, this algorithm considers all the rectangles that may calculate the minimum perimeter. In addition to the initial values, the main cycle of the algorithm only needs to execute the total number of vertices multiple times. Therefore, the algorithm is linear in time complexity.

Problem handling also contains triangles. There are two special cases. For more information, see onion triangle and spiral triangle.

 

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