Re-ordered all references in the style selector dialog to have one consistent ordering.
[geda-pcb/whiteaudio.git] / src / polygon.h
blobbdbef464613809a4832d29e43ff7c3be4e0e55c1
1 /*
2 * COPYRIGHT
4 * PCB, interactive printed circuit board design
5 * Copyright (C) 1994,1995,1996 Thomas Nau
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * Contact addresses for paper mail and Email:
22 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
23 * Thomas.Nau@rz.uni-ulm.de
25 * RCS: $Id$
28 /* prototypes for polygon editing routines
31 #ifndef PCB_POLYGON_H
32 #define PCH_POLYGON_H
34 #include "global.h"
36 /* Implementation constants */
38 #define POLY_CIRC_SEGS 40
39 #define POLY_CIRC_SEGS_F ((float)POLY_CIRC_SEGS)
41 /* adjustment to make the segments outline the circle rather than connect
42 * points on the circle: 1 - cos (\alpha / 2) < (\alpha / 2) ^ 2 / 2
44 #define POLY_CIRC_RADIUS_ADJ (1.0 + M_PI / POLY_CIRC_SEGS_F * \
45 M_PI / POLY_CIRC_SEGS_F / 2.0)
47 /* polygon diverges from modelled arc no more than MAX_ARC_DEVIATION * thick */
48 #define POLY_ARC_MAX_DEVIATION 0.02
50 /* Prototypes */
52 void polygon_init (void);
53 Cardinal polygon_point_idx (PolygonTypePtr polygon, PointTypePtr point);
54 Cardinal polygon_point_contour (PolygonTypePtr polygon, Cardinal point);
55 Cardinal prev_contour_point (PolygonTypePtr polygon, Cardinal point);
56 Cardinal next_contour_point (PolygonTypePtr polygon, Cardinal point);
57 Cardinal GetLowestDistancePolygonPoint (PolygonTypePtr,
58 Coord, Coord);
59 bool RemoveExcessPolygonPoints (LayerTypePtr, PolygonTypePtr);
60 void GoToPreviousPoint (void);
61 void ClosePolygon (void);
62 void CopyAttachedPolygonToLayer (void);
63 int PolygonHoles (PolygonType *ptr, const BoxType *range,
64 int (*callback) (PLINE *, void *user_data),
65 void *user_data);
66 int PlowsPolygon (DataType *, int, void *, void *,
67 int (*callback) (DataTypePtr, LayerTypePtr, PolygonTypePtr, int, void *, void *));
68 void ComputeNoHoles (PolygonType *poly);
69 POLYAREA * ContourToPoly (PLINE *);
70 POLYAREA * PolygonToPoly (PolygonType *);
71 POLYAREA * RectPoly (Coord x1, Coord x2, Coord y1, Coord y2);
72 POLYAREA * CirclePoly (Coord x, Coord y, Coord radius);
73 POLYAREA * OctagonPoly(Coord x, Coord y, Coord radius);
74 POLYAREA * LinePoly(LineType *l, Coord thick);
75 POLYAREA * ArcPoly(ArcType *l, Coord thick);
76 POLYAREA * PinPoly(PinType *l, Coord thick, Coord clear);
77 POLYAREA * BoxPolyBloated (BoxType *box, Coord radius);
78 void frac_circle (PLINE *, Coord, Coord, Vector, int);
79 int InitClip(DataType *d, LayerType *l, PolygonType *p);
80 void RestoreToPolygon(DataType *, int, void *, void *);
81 void ClearFromPolygon(DataType *, int, void *, void *);
83 bool IsPointInPolygon (Coord, Coord, Coord, PolygonTypePtr);
84 bool IsPointInPolygonIgnoreHoles (Coord, Coord, PolygonTypePtr);
85 bool IsRectangleInPolygon (Coord, Coord, Coord, Coord, PolygonTypePtr);
86 bool isects (POLYAREA *, PolygonTypePtr, bool);
87 bool MorphPolygon (LayerTypePtr, PolygonTypePtr);
88 void NoHolesPolygonDicer (PolygonType *p, const BoxType *clip,
89 void (*emit) (PLINE *, void *), void *user_data);
90 void PolyToPolygonsOnLayer (DataType *, LayerType *, POLYAREA *, FlagType);
92 #endif