
计算几何模板
protecteyesight
我向往天空的湛蓝和一望无际。保护视力,只为看到更远的天空。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
叉积求三点转向问题
依次给出ABC三个点的坐标,求从A经过B到达C,在B点向哪个方向转身。用叉积做。int main(){ int a,b,c,d,e,f,n,ans; cin>>n; for(int i=0;i<n;i++) {cin>>a>>b>>c>>d>>e>>f; ans=(e-a)*(d-b)-(f-b)*(c-a);//ans计算叉积 if(ans==0)co原创 2017-04-03 21:52:36 · 453 阅读 · 0 评论 -
计算n边形面积
struct Point//点的定义{ double x,y; Point(){} Point(double _x,double _y) { x=_x;y=_y; } double operator ^(const Point &b)const { return x*b.y-y*b.x; }};原创 2017-04-03 21:53:16 · 1175 阅读 · 0 评论 -
计算叉积
struct point//点的定义{ double x; double y;};struct V//向量的定义{ point sstart; point eend;};double Cross(V*v1,V *v2)//叉积{ V vt1,vt2; double result=0; vt1.sstart.x=0; vt原创 2017-04-03 21:54:19 · 465 阅读 · 0 评论 -
判断两线段相交
#include using namespace std;struct Point//点的定义{ double x,y;};typedef struct line//向量定义{ Point start,end;}vector;double multi(Point p1,Point p2,Point p0){ return (p1.x-p0.x)*(p原创 2017-04-03 21:55:35 · 277 阅读 · 0 评论 -
求最小覆盖圆
#include #include #include #include using namespace std;struct Point{ double x,y;};Point a[1005],d;double r;double dist(Point A,Point B){ return sqrt((A.x-B.x)*(A.x-B.x)+(A.y-B.原创 2017-04-03 21:56:22 · 352 阅读 · 0 评论 -
hdu 5120 Intersection (圆相交面积模板)
Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples you may know. A ring is a 2-D figure bounded by two circl原创 2017-06-26 14:19:27 · 388 阅读 · 0 评论