20 static double epsilon = 0.0;
21 static struct path ll_path, clip_path, raw_path, eps_path;
23 static struct vector cur;
27 static int window_set;
29 #define min(x, y) ((x) < (y) ? (x) : (y))
30 #define max(x, y) ((x) > (y) ? (x) : (y))
34 static int shift_count(
double dx)
36 return (
int)floor(dx / 360);
39 static double shift_angle(
double dx)
41 return shift_count(dx) * 360;
44 static double coerce(
double x)
52 static int euclidify(
struct path *p,
int no_pole)
54 double ux0 =
clip.left;
55 double ux1 =
clip.rite;
62 for (i = 1; i < p->
count; i++) {
74 lo = -shift_count(ux1 - x0);
75 hi = shift_count(x1 - ux0);
78 for (i = 0; i < p->
count; i++)
84 static void ll_wrap_path(
struct path *
dst,
const struct path *
src,
int no_pole)
92 for (i = 0; i <
count; i++) {
93 for (j = 0; j <
src->count; j++) {
106 for (i = 0; i <
dst->count; i++) {
113 static void reduce_path(
struct path *
dst,
const struct path *
src,
double eps)
121 for (i = 1; i <
src->count - 1; i++) {
124 struct vertex *v2 = &
src->vertices[i + 1];
126 if (fabs(v1->
x - v0->
x) < eps && fabs(v1->
y - v0->
y) < eps &&
127 fabs(v1->
x - v2->
x) < eps && fabs(v1->
y - v2->
y) < eps &&
133 v = &
src->vertices[
src->count - 1];
240 static void do_path(
int no_pole)
250 ll_wrap_path(&ll_path, p, no_pole);
269 conv_path(&raw_path, p);
273 reduce_path(&eps_path, p, epsilon);
278 for (i = 0; i < p->
count; i++) {
346 for (i = 0; i < p->
count; i++) {
355 if (x < clip.left || x >
clip.rite)
357 if (y < clip.bot || y >
clip.
top)
370 static void poly_abs(
const double *
x,
const double *
y,
int n)
379 for (i = 1; i < n; i++)
411 void D_box_abs(
double x1,
double y1,
double x2,
double y2)
413 struct vector save = cur;
429 static void poly_rel(
const double *
x,
const double *y,
int n)
438 for (i = 1; i < n; i++)
490 D_box_abs(cur.x, cur.y, cur.x + x2, cur.y + y2);
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)
double D_d_to_u_col(double)
screen to earth (x)
double D_u_to_d_row(double)
earth to screen (north)
double D_u_to_d_col(double)
earth to screen (east)
double D_d_to_u_row(double)
screen to earth (y)
void D_get_src(double *, double *, double *, double *)
returns frame bounds in source coordinate system
void D_polydots_abs(const double *x, const double *y, int n)
void D_pos_abs(double x, double y)
void D_set_clip(double t, double b, double l, double r)
set clipping window
void D_move_rel(double x, double y)
void D_line_abs(double x1, double y1, double x2, double y2)
void D_get_text_box(const char *text, double *t, double *b, double *l, double *r)
void D_box_rel(double x2, double y2)
void D_pos_rel(double x, double y)
void D_cont_rel(double x, double y)
void D_line_width(double d)
void D_polydots_rel(const double *x, const double *y, int n)
void D_cont_abs(double x, double y)
void D_line_rel(double x1, double y1, double x2, double y2)
void D_set_reduction(double e)
void D_clip_to_map(void)
set clipping window to map window
void D_polyline_rel(const double *x, const double *y, int n)
void D_polyline_abs(const double *x, const double *y, int n)
void D_move_abs(double x, double y)
void D_box_abs(double x1, double y1, double x2, double y2)
void D_set_clip_mode(int mode)
void D_polygon_rel(const double *x, const double *y, int n)
void D_polygon_abs(const double *x, const double *y, int n)
void COM_Cont(double x, double y)
void COM_Move(double x, double y)
void COM_Point(double x, double y)
void path_close(struct path *p)
void path_copy(struct path *dst, const struct path *src)
void path_reset(struct path *p)
void path_begin(struct path *p)
void path_cont(struct path *p, double x, double y)
void path_append(struct path *p, double x, double y, int mode)
void path_move(struct path *p, double x, double y)
void COM_Pos_abs(double, double)
void COM_Get_text_box(const char *, double *, double *, double *, double *)
void COM_Line_width(double)
struct plane left rite bot top