12static double dist_plane(
double x,
double y,
const struct plane *p)
14 return x * p->
x + y * p->
y + p->
k;
17static double interpolate(
double a,
double b,
double ka,
double kb)
22static void clip_path_plane(
struct path *dst,
const struct path *src,
23 const struct plane *p)
28 double d0 = dist_plane(x0,
y0, p);
33 for (i = 0; i < src->
count; i++) {
37 double d1 = dist_plane(x1, y1, p);
43 double x = interpolate(x0, x1,
d0,
d1);
44 double y = interpolate(
y0, y1,
d0,
d1);
50 double x = interpolate(x0, x1,
d0,
d1);
51 double y = interpolate(
y0, y1,
d0,
d1);
67static void cull_path_plane(
struct path *dst,
const struct path *src,
68 const struct plane *p)
71 int prev = src->
count - 1;
75 double d0 = dist_plane(x0,
y0, p);
80 for (i = 0; i < src->
count; i++) {
84 double d1 = dist_plane(x1, y1, p);
88 if (!
in0 &&
in1 && last != prev) {
136 cull_path_plane(&
tmp1, src, &
clip->left);
153 clip_path_plane(&
tmp1, src, &
clip->left);
void D__cull_path(struct path *dst, const struct path *src, const struct clip *clip)
void D__clip_path(struct path *dst, const struct path *src, const struct clip *clip)
void D__set_clip_planes(struct clip *clip, const struct rectangle *rect)
void path_reset(struct path *p)
void path_free(struct path *p)
void path_cont(struct path *p, double x, double y)
void path_move(struct path *p, double x, double y)
void path_init(struct path *p)
struct plane left rite bot top