43 #ifndef SWORD25_LINE_H 44 #define SWORD25_LINE_H 46 #include "sword25/kernel/common.h" 61 return triangleArea2(a, b, c) > 0;
65 return triangleArea2(a, b, c) >= 0;
77 return triangleArea2(a, b, c) < 0;
81 return triangleArea2(a, b, c) <= 0;
92 return triangleArea2(a, b, c) == 0;
95 enum VERTEX_CLASSIFICATION {
111 int area = triangleArea2(a, b, c);
112 if (area > 0)
return LEFT;
113 if (area < 0)
return RIGHT;
131 if (class1 == ON || class2 == ON || class3 == ON || class4 == ON)
return false;
133 return ((class1 == LEFT) ^(class2 == LEFT)) && ((class3 == LEFT) ^(class4 == LEFT));
144 if (triangleArea2(a, b, c) != 0)
return false;
148 return ((a.
x <= c.
x) &&
153 return ((a.
y <= c.
y) &&
162 if (triangleArea2(a, b, c) != 0)
return false;
166 return ((a.
x < c.
x) &&
171 return ((a.
y < c.
y) &&
186 return a.
x * b.
y - a.
y * b.
x +
187 a.
y * c.
x - a.
x * c.
y +
188 b.
x * c.
y - c.
x * b.
y;
static VERTEX_CLASSIFICATION classifyVertexToLine(const Vertex &a, const Vertex &b, const Vertex &c)
Definition: line.h:110
static bool isVertexOn(const Vertex &a, const Vertex &b, const Vertex &c)
Definition: line.h:91
int16 x
Definition: rect.h:46
static bool isOnLine(const Vertex &a, const Vertex &b, const Vertex &c)
Definition: line.h:142
int16 y
Definition: rect.h:47
static bool isVertexLeft(const Vertex &a, const Vertex &b, const Vertex &c)
Definition: line.h:60
static bool isVertexRight(const Vertex &a, const Vertex &b, const Vertex &c)
Definition: line.h:76
static bool doesIntersectProperly(const Vertex &a, const Vertex &b, const Vertex &c, const Vertex &d)
Definition: line.h:125