HDU 3694 Fermat Point in Quadrangle)

Source: Internet
Author: User


Here are four points for you to find the minimum distance between one point and four points.


The feathed point of the Quadrilateral: the convex side is the intersection of two diagonal lines, and the concave side is a concave point.


PS:

The horse points of the triangle:

1. If the three inner angles of a triangle are less than 120 °, the three inner angles of the triangle are exactly the same as those of the third equi-fenma point, that is, the angle of the triangle on which the vertex is located is equal to 120 °. Therefore, the fenma point of a triangle is also called the Equi-angle center of a triangle.

2. If a triangle has an inner angle greater than or equal to 120 °, the vertices of the inner angle are the points of distance and minimum.


# Include
 
  
# Include
  
   
# Include
   
    
# Include
    
     
# Include
     
      
# Include
      # Include
       
         # Include
        
          Using namespace std; const int kind = 26; const int maxn = 250*1000; // Note RE, word length * Number of words const int M = 5100000; struct Point {double x, y ;}; // less than 0, indicating that the polar angle of the vector p0p1 is greater than the Polar Angle of p0p2, double multiply (Point p1, Point p2, Point p0) {return (p1.x-forwarded X) * (p2.y-p0.y)-(p2.x-p0.x) * (p1.y-p0.y);} double dis (Point p1, Point p2) {return (sqrt (p1.x-p2.x) * (p1.x-p2.x) + (p1.y-p2.y) * (p1.y-p2.y);} void Graham_scan (Point PointSet [], Point ch [], int n, int & len) {int I, j, k = 0, top = 2; Point tmp; // locate the lowest and leftmost Point for (I = 1; I
         
           0) | (multiply (PointSet [j], PointSet [k], PointSet [0]) = 0) & (dis (PointSet [0], pointSet [j])
          
            = 0) top --; // The current vertex and all vertices in the stack meet the left-facing relationship. ch [++ top] = PointSet [I];} len = top + 1;} Point intersection (Point u1, Point u2, Point v1, Point v2) {Point ret = u1; double t = (u1.x-v1.x) * (v1.y-v2.y)-(u1.y-v1.y) * (v1.x-v2.x )) /(u1.x-u2.x) * (v1.y-v2.y)-(u1.y-u2.y) * (v1.x-v2.x); ret. x + = (u2.x-u1.x) * t; ret. y + = (u2.y-u1.y) * t; return ret;} Point p [4], ch [4], point; int len; int main () {int x1, y1, x2, y2, x3, y3, x4, y4; int x [4], y [ 4]; while (scanf ("% lf", & p [0]. x, & p [0]. y) {int flag = 0; if (p [0]. x! =-1 | p [0]. y! =-1) flag = 1; for (int I = 1; I <4; I ++) {scanf ("% lf", & p [I]. x, & p [I]. y); if (p [I]. x! =-1 | p [I]. y! =-1) flag = 1;} if (! Flag) break; double minn = 10000000, ans = 0.0; int k = 0; Graham_scan (p, ch, 4, len); for (int I = 0; I <4; I ++) {ans = 0.0; for (int j = 0; j <4; j ++) {ans + = dis (p [I], p [j]);} if (ans
           
            

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.