6 * PCB, interactive printed circuit board design
7 * Copyright (C) 1994,1995,1996 Thomas Nau
8 * Copyright (C) 2004 harry eaton
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 * Contact addresses for paper mail and Email:
25 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
26 * Thomas.Nau@rz.uni-ulm.de
44 #ifdef HAVE_LIBDMALLOC
50 /* Clip the line to the clipBox
51 * return True if something to be drawn
52 * false if the whole thing is clipped
55 ClipLine (double minx
, double miny
, double maxx
, double maxy
,
56 double *x1
, double *y1
,
57 double *x2
, double *y2
,
67 /* clip first point on left side */
75 *y1
+= r
* (*y2
- *y1
);
77 /* clip second point on left side */
83 *y2
+= r
* (*y1
- *y2
);
85 /* clip first point on right side */
93 *y1
+= r
* (*y2
- *y1
);
95 /* clip second point on right side */
101 *y2
+= r
* (*y1
- *y2
);
104 /* clip first point on top */
110 r
= (miny
- *y1
) / d
;
112 *x1
+= r
* (*x2
- *x1
);
114 /* clip second point on top */
118 r
= (miny
- *y2
) / d
;
120 *x2
+= r
* (*x1
- *x2
);
122 /* clip first point on bottom */
128 r
= (maxy
- *y1
) / d
;
130 *x1
+= r
* (*x2
- *x1
);
132 /* clip second point on top */
136 r
= (maxy
- *y2
) / d
;
138 *x2
+= r
* (*x1
- *x2
);