22 static double epsilon = 0.0;
23 static struct path ll_path, clip_path, raw_path, eps_path;
25 static struct vector cur;
29 static int window_set;
31 #define min(x,y) ((x) < (y) ? (x) : (y)) 32 #define max(x,y) ((x) > (y) ? (x) : (y)) 36 static int shift_count(
double dx)
38 return (
int)floor(dx / 360);
41 static double shift_angle(
double dx)
43 return shift_count(dx) * 360;
46 static double coerce(
double x)
54 static int euclidify(
struct path *p,
int no_pole)
56 double ux0 =
clip.left;
57 double ux1 =
clip.rite;
64 for (i = 1; i < p->
count; i++) {
75 lo = -shift_count(ux1 - x0);
76 hi = shift_count(x1 - ux0);
79 for (i = 0; i < p->
count; i++)
85 static void ll_wrap_path(
struct path *
dst,
const struct path *src,
int no_pole)
91 count = euclidify(dst, no_pole);
93 for (i = 0; i <
count; i++) {
94 for (j = 0; j < src->
count; j++) {
101 static void conv_path(
struct path *dst,
const struct path *src)
107 for (i = 0; i < dst->
count; i++) {
114 static void reduce_path(
struct path *dst,
const struct path *src,
double eps)
122 for (i = 1; i < src->
count - 1; i++) {
127 if (fabs(v1->
x - v0->
x) < eps && fabs(v1->
y - v0->
y) < eps &&
128 fabs(v1->
x - v2->
x) < eps && fabs(v1->
y - v2->
y) < eps &&
206 double tmp = *
t; *t = *
b; *b = tmp;
210 double tmp = *
r; *r = *
l; *l = tmp;
236 static void do_path(
int no_pole)
246 ll_wrap_path(&ll_path, p, no_pole);
265 conv_path(&raw_path, p);
269 reduce_path(&eps_path, p, epsilon);
274 for (i = 0; i < p->
count; i++) {
343 for (i = 0; i < p->
count; i++) {
352 if (x < clip.left || x >
clip.rite)
354 if (y < clip.bot || y >
clip.
top)
367 static void poly_abs(
const double *
x,
const double *
y,
int n)
376 for (i = 1; i < n; i++)
408 void D_box_abs(
double x1,
double y1,
double x2,
double y2)
410 struct vector save = cur;
426 static void poly_rel(
const double *
x,
const double *y,
int n)
435 for (i = 1; i < n; i++)
487 D_box_abs(cur.x, cur.y, cur.x + x2, cur.y + y2);
void D_set_clip(double t, double b, double l, double r)
set clipping window
void COM_Line_width(double)
void D__set_clip_planes(struct clip *clip, const struct rectangle *rect)
double D_d_to_u_row(double)
screen to earth (y)
void COM_Cont(double x, double y)
void path_close(struct path *p)
void D_pos_rel(double x, double y)
void D_polygon_abs(const double *x, const double *y, int n)
void path_cont(struct path *p, double x, double y)
void COM_Point(double x, double y)
void D_polyline_rel(const double *x, const double *y, int n)
void D_polydots_rel(const double *x, const double *y, int n)
void D_polydots_abs(const double *x, const double *y, int n)
void path_move(struct path *p, double x, double y)
void D__cull_path(struct path *dst, const struct path *src, const struct clip *clip)
void D_line_width(double d)
void path_reset(struct path *p)
void D_move_abs(double x, double y)
void D_move_rel(double x, double y)
void D__clip_path(struct path *dst, const struct path *src, const struct clip *clip)
void D_polyline_abs(const double *x, const double *y, int n)
void D_set_clip_mode(int mode)
struct plane left rite bot top
void D_set_reduction(double e)
double D_u_to_d_row(double)
earth to screen (north)
void D_box_abs(double x1, double y1, double x2, double y2)
void path_copy(struct path *dst, const struct path *src)
void D_get_src(double *, double *, double *, double *)
returns frame bounds in source coordinate system
void D_cont_abs(double x, double y)
void D_box_rel(double x2, double y2)
void D_pos_abs(double x, double y)
double D_u_to_d_col(double)
earth to screen (east)
void D_cont_rel(double x, double y)
void COM_Pos_abs(double, double)
void D_get_text_box(const char *text, double *t, double *b, double *l, double *r)
void COM_Move(double x, double y)
void path_begin(struct path *p)
void D_line_rel(double x1, double y1, double x2, double y2)
void D_line_abs(double x1, double y1, double x2, double y2)
void path_append(struct path *p, double x, double y, int mode)
double D_d_to_u_col(double)
screen to earth (x)
void D_polygon_rel(const double *x, const double *y, int n)
void D_clip_to_map(void)
set clipping window to map window
void COM_Get_text_box(const char *, double *, double *, double *, double *)