36 #define _USE_MATH_DEFINES
43 #define M_PI 3.14159265358979323846264338327
48 const double PI_3div4 = 3 * M_PI / 4;
49 const double PI_div2 = 1.57079632679489661923;
50 const double EPSILON = 1e-12;
52 enum Orientation { CW, CCW, COLLINEAR };
66 double detleft = (pa.x - pc.x) * (pb.y - pc.y);
67 double detright = (pa.y - pc.y) * (pb.x - pc.x);
68 double val = detleft - detright;
69 if (val > -EPSILON && val < EPSILON) {
111 bool InScanArea(
const Point& pa,
const Point& pb,
const Point& pc,
const Point& pd)
113 double oadb = (pa.x - pb.x)*(pd.y - pb.y) - (pd.x - pb.x)*(pa.y - pb.y);
114 if (oadb >= -EPSILON) {
118 double oadc = (pa.x - pc.x)*(pd.y - pc.y) - (pd.x - pc.x)*(pa.y - pc.y);
119 if (oadc <= EPSILON) {
Sweep-line, Constrained Delauney Triangulation (CDT) See: Domiter, V.
Definition: shapes.cpp:34
Orientation Orient2d(const Point &pa, const Point &pb, const Point &pc)
Forumla to calculate signed area Positive if CCW Negative if CW 0 if collinear
Definition: utils.h:64