Branching algorithm-convex hull problem

Source: Internet
Author: User
Tags x2 y2

A convex polygon that can completely contain n given points on a plane. This problem generally uses the fast packet algorithm.

Quick Bag Idea:

1) The n points are sorted by the left of X, and the P1 and PN are found, and the line P1->PN divides the points on the plane into two parts S1 and S2, which are the two parts of the upper and lower packets, and the recursive solution.

2) How to find S1 and S2, the two parts of the same algorithm, take S1 as an example. If S1 is empty, the upper packet is a P1 and PN line segment for the endpoint. If S1 is not empty, find the vertex pmax in S1, which is the farthest point from the line p1pn. The algorithm then finds all the points in the S1 to the left of the line P1pmax, and these points and P1,pmax constitute the set s1,1. In the same vein, the line pmaxpn to the left of the point and PMAX,PN constitute the set s1,2. This will always be handed down and eventually the entire set of packages can be obtained.

How to ask for PAMX? Three points on any plane, P1 (x1,y1), P2 (X2,y2), P3 (X3,y3), then the area of the triangle equals one-second of the absolute value of the following determinant:

|x1 Y1 1|

|x2 y2 1| = x1y2 + x3y1 + x2y3-x3y2-x2y1-x1y3

|X3 Y3 1|

Pmax is the largest point in the area.

How do I find the point on the left? when and only if Point P3 (X3,y3) is on the left side of the line, the above evaluates to positive. Using this formula, you can determine at a fixed time whether a point is on the left side of a line.

Branching algorithm-convex hull problem

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.