plct-lab/cross-checker/include/cross-checker.h

39 lines
721 B
C++

//
// Created by ricardo on 19/05/25.
//
#ifndef CROSS_CHECKER_H
#define CROSS_CHECKER_H
namespace cross_checker
{
// 既可以表示点也可以表示一个向量
struct Point
{
double x;
double y;
Point(const double a, const double b) : x(a), y(b)
{
}
static int orientation(const Point& p, const Point& q, const Point& r);
static bool onSegment(const Point& p, const Point& q, const Point& r);
};
struct Line
{
Point startPoint;
Point endPoint;
Line(const Point a, const Point b): startPoint(a), endPoint(b)
{
}
bool intersect(const Line& other);
};
}
#endif //CROSS_CHECKER_H