4 * \brief Functions for inserting points into objects.
8 * <h1><b>Copyright.</b></h1>\n
10 * PCB, interactive printed circuit board design
12 * Copyright (C) 1994,1995,1996 Thomas Nau
14 * Copyright (C) 2004 harry eaton
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 * Contact addresses for paper mail and Email:
31 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
32 * Thomas.Nau@rz.uni-ulm.de
49 #ifdef HAVE_LIBDMALLOC
54 * \brief Clip the line to the clipBox.
56 * Clip X,Y to the given bounding box, plus a margin.
58 * \return true if something to be drawn, false if the whole thing is
62 ClipLine (double minx
, double miny
, double maxx
, double maxy
,
63 double *x1
, double *y1
,
64 double *x2
, double *y2
,
74 /* clip first point on left side */
82 *y1
+= r
* (*y2
- *y1
);
84 /* clip second point on left side */
90 *y2
+= r
* (*y1
- *y2
);
92 /* clip first point on right side */
100 *y1
+= r
* (*y2
- *y1
);
102 /* clip second point on right side */
106 r
= (maxx
- *x2
) / d
;
108 *y2
+= r
* (*y1
- *y2
);
111 /* clip first point on top */
117 r
= (miny
- *y1
) / d
;
119 *x1
+= r
* (*x2
- *x1
);
121 /* clip second point on top */
125 r
= (miny
- *y2
) / d
;
127 *x2
+= r
* (*x1
- *x2
);
129 /* clip first point on bottom */
135 r
= (maxy
- *y1
) / d
;
137 *x1
+= r
* (*x2
- *x1
);
139 /* clip second point on top */
143 r
= (maxy
- *y2
) / d
;
145 *x2
+= r
* (*x1
- *x2
);