54 bool inside1 =
INSIDE(p, b);
55 bool inside2 =
INSIDE(q, b);
56 if (inside1 != inside2) {
59 if (inside1 && inside2) {
78 }
else if (p.
y == q.
y) {
94 m = (q.
y - p.
y)/(q.
x - p.
x);
95 double low = fmin(p.
x, q.
x);
96 double high = fmax(p.
x, q.
x);
102 y = p.
y + (b.
LL.
x - p.
x)*m;
120 low = fmin(p.
y, q.
y);
121 high = fmax(p.
y, q.
y);
122 x = p.
x + (b.
LL.
y - p.
y)/m;
141 p[3].
x = p[2].
x = p[1].
x;
149 assert(cwrot == 0 || cwrot == 90 || cwrot == 180 || cwrot == 270);
150 double x = p.
x, y = p.
y;
174 assert(ccwrot == 0 || ccwrot == 90 || ccwrot == 180 || ccwrot == 270);
175 double x = p.
x, y = p.
y;
213#define SMALL 0.0000000001
222 double a2 = (p.
y-a.
y)*
dx - (p.
x-a.
x)*
dy;
224 if (a2 <
SMALL)
return 0.;
228#define dot(v,w) (v.x*w.x+v.y*w.y)
241 double lc = -
dot(ln,c);
242 double dt =
dot(ln,mv);
244 if (fabs(dt) <
SMALL)
return 0;
int lineToBox(pointf p, pointf q, boxf b)
boxf flip_rec_boxf(boxf b, pointf p)
void rect2poly(pointf *p)
pointf ccwrotatepf(pointf p, int ccwrot)
double ptToLine2(pointf a, pointf b, pointf p)
pointf cwrotatepf(pointf p, int cwrot)
int line_intersect(pointf a, pointf b, pointf c, pointf d, pointf *p)
geometric types and macros (e.g. points and boxes)
geometric functions (e.g. on points and boxes)
static pointf sub_pointf(pointf p, pointf q)
static pointf scale(double c, pointf p)
static pointf perp(pointf p)