4 * PCB, interactive printed circuit board design
5 * Copyright (C) 1994,1995,1996 Thomas Nau
6 * Copyright (C) 2004 harry eaton
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * Contact addresses for paper mail and Email:
23 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
24 * Thomas.Nau@rz.uni-ulm.de
42 #ifdef HAVE_LIBDMALLOC
46 /* Clip the line to the clipBox
47 * return true if something to be drawn
48 * false if the whole thing is clipped
51 ClipLine (double minx
, double miny
, double maxx
, double maxy
,
52 double *x1
, double *y1
,
53 double *x2
, double *y2
,
63 /* clip first point on left side */
71 *y1
+= r
* (*y2
- *y1
);
73 /* clip second point on left side */
79 *y2
+= r
* (*y1
- *y2
);
81 /* clip first point on right side */
89 *y1
+= r
* (*y2
- *y1
);
91 /* clip second point on right side */
97 *y2
+= r
* (*y1
- *y2
);
100 /* clip first point on top */
106 r
= (miny
- *y1
) / d
;
108 *x1
+= r
* (*x2
- *x1
);
110 /* clip second point on top */
114 r
= (miny
- *y2
) / d
;
116 *x2
+= r
* (*x1
- *x2
);
118 /* clip first point on bottom */
124 r
= (maxy
- *y1
) / d
;
126 *x1
+= r
* (*x2
- *x1
);
128 /* clip second point on top */
132 r
= (maxy
- *y2
) / d
;
134 *x2
+= r
* (*x1
- *x2
);