Wall poj1113凸包 圓的弧長

2021-06-18 15:44:57 字數 1601 閱讀 5520

題意:給一些點,用乙個多邊形把這些點包起來,並且所有點到邊的距離至少為l

思路:先求乙個凸包然後再加上乙個圓的弧長,為什麼加圓的弧長呢?可以證明每個頂點到他距離為l的點組成了乙個圓弧,過該點做兩條垂線可以證明所有點的這些圓弧這些角度加起來正好360度是乙個圓,所有就加上乙個半徑為l的圓

#include#include#include#include#include#includeusing namespace std;

struct point

};typedef point vector;

vector operator + (vector a,vector b)

vector operator - (vector a,vector b)

vector operator * (vector a,double p)

vector operator / (vector a,double p)

const double eps = 1e-9;

const double pi = acos(-1.0);

double dot(vector a,vector b)

double length(vector a)

double cross(vector a,vector b)

int dcmp(double x)

bool operator < (point a,point b)

bool operator == ( point a, point b)

double angle(vector a,vector b)

double area(point a,point b,point c)

vector rotate(vector a,double rad)

vector normal(vector a)

point getlineintersection(point p,vector v,point q,vector w)

bool segmentproperintersection(point a1,point a2,point b1,point b2)

bool onsengment(point p,point a,point b)

double polyarea(point *p,int n)

return area/2;

}struct line

;int convexhull(point* p,int n,point* ch)

int k = m;

for(int i = n-2 ; i >= 0; i--)

if(n > 1) m--;

return m;

}point p[1005];

int main()

point ch[1005];

int m = convexhull(p,n,ch);

double ans = 0;

for(int i = 0; i < m; i++)

ans = ans + 2*pi * l;

printf("%.0lf\n",ans);

}return 0;

}

BZOJ2829 信用卡凸包(圓的凸包)

傳送門 題解 難道覺得這道題不簡單的只有我乙個麼。首先看一道類似的題 poj1113 wall 給一堆同樣半徑的圓,求凸包。在同樣半徑的前提下,顯然圓心所形成的凸包內部的點是沒有任何意義的,因為能被外面的凸包圓間的切線覆蓋。那麼直接求圓心的凸包就好了。那麼這道題就好做了,原題相當於是給你四個圓,求凸...

poj 1113 凸包模板

include include include include include include using namespace std define n 1050 define pi acos 1.0 int n,r struct point point operator point b const...

凸包初學(POJ1113)

第一道凸包的題目。凸包 對乙個簡單多邊形來說,如果給定其邊界上或者內部上的兩個點,連線著兩個點 連線這兩個點的線段上的所有點都被包含在該多邊形的邊界上或內部的話,則該多邊形為凸多邊形 給你一些點,用這些點連出凸多邊形,要求所有點都在所連成的凸多邊形邊界或內部。選擇乙個左下角的左邊點 當做起始點。鏈結...