几何版子mark一下

#include <bits/stdc++.h>
#define ll long long
#define ms(x) memset(x, 0, sizeof(x))
#define inf 0x3f3f3f3f
using namespace std;
const double eps = 1e-8;
int cmp(double x){
    if(fabs(x) < eps) return 0;
    if(x > 0) return 1;
    return -1;
}
inline double sqr(double x){
    return x*x;
}
struct point{
    double x, y;
    point(){}
    point(double a, double b):x(a), y(b){}
    void input(){
        scanf("%lf%lf", &x, &y);
    }
    friend point operator + (const point &a, const point &b){
        return point(a.x+b.x, a.y+b.y);
    }
    friend point operator -(const point &a, const point &b){
        return point(a.x-b.x, a.y-b.y);
    }
    friend bool operator==( const point &a, const point &b){
        return cmp(a.x - b.x) == 0 && cmp(a.y - b.y) ==0;
    }
    double norm(){
        return sqrt(sqr(x) + sqr(y));
    }
};
double det(const point &a, const point &b){
    return a.x * b.y - a.y*b.x;
}
double dot(const point &a, const point &b){
    return a.x * b.x + a.y*b.y;
}
double dist(const point &a, const point &b){
    return (a-b).norm();
}
struct line{
    point a, b;
    line(){}
    line(point x, point y):a(x), b(y){}
};
line poit_make_line(const point a, const point b){
    return line(a, b);
}
bool PointOnSegment(point p, point s, point t){
    return cmp(det(p-s, t-s))==0 && cmp(dot(p-s, p-t))<=0;
}
int main()
{

    return 0;
}


猜你喜欢

转载自blog.csdn.net/khn64/article/details/79934064
今日推荐