UVA 10867 Cutting a Polygon

呵呵

又A不过去  还搜不到题解  给跪

给组高端样例

input:

9 1
0 0
0 2
1 1
2 2
3 1
4 2
5 1
6 2
6 0
0 2 2 0
0 0

output:

2.828

 

//大白p263
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
const double eps=1e-8;//精度
const int INF=1<<29;
const double PI=acos(-1.0);
int dcmp(double x){//判断double等于0或。。。
	if(fabs(x) Polygon;
Vector operator+(Vector a,Vector b){return Vector(a.x+b.x,a.y+b.y);}//向量+向量=向量
Vector operator-(Point a,Point b){return Vector(a.x-b.x,a.y-b.y);}//点-点=向量
Vector operator*(Vector a,double p){return Vector(a.x*p,a.y*p);}//向量*实数=向量
Vector operator/(Vector a,double p){return Vector(a.x/p,a.y/p);}//向量/实数=向量
bool operator<( const Point& A,const Point& B ){return dcmp(A.x-B.x)<0||(dcmp(A.x-B.x)==0&&dcmp(A.y-B.y)<0);}
bool operator==(const Point&a,const Point&b){return dcmp(a.x-b.x)==0&&dcmp(a.y-b.y)==0;}
bool operator!=(const Point&a,const Point&b){return a==b?false:true;}
struct Segment{
	Point a,b;
	Segment(){}
	Segment(Point _a,Point _b){a=_a,b=_b;}
	bool friend operator<(const Segment& p,const Segment& q){return p.a0) return Length(v3);
	else return fabs(Cross(v1,v2))/Length(v1);
}
bool isPointOnSegment(Point p,Segment s){
	return dcmp(Cross(s.a-p,s.b-p))==0&&dcmp(Dot(s.a-p,s.b-p))<0;
}
int isPointInPolygon(Point p, Point* poly,int n){//点与多边形的位置关系
	int wn=0;
	for(int i=0;i0&&d1<=0&&d2>0)wn++;
		if(k<0&&d2<=0&&d1>0)wn--;
	}
	if(wn) return 1;//点在内部
	else return 0;//点在外部
}
//--------------------------------------
//--------------------------------------
//--------------------------------------
//--------------------------------------
//--------------------------------------
int n,m;
Point arr[1010];
struct node{
	Point p;
	bool mark;
	bool friend operator<(node a,node b){
		return a.p


 

 

你可能感兴趣的:(二维计算几何,未能AC呵呵呵)