pcb 4.1.1
An interactive printed circuit board layout editor.

polygon.h

Go to the documentation of this file.
00001 
00035 #ifndef PCB_POLYGON_H
00036 #define PCB_POLYGON_H
00037 
00038 #include "global.h"
00039 
00040 /* Implementation constants */
00041 
00042 #define POLY_CIRC_SEGS 40
00043 #define POLY_CIRC_SEGS_F ((float)POLY_CIRC_SEGS)
00044 
00050 #define POLY_CIRC_RADIUS_ADJ (1.0 + M_PI / POLY_CIRC_SEGS_F * \
00051                                     M_PI / POLY_CIRC_SEGS_F / 2.0)
00052 
00057 #define POLY_ARC_MAX_DEVIATION 0.02
00058 
00059 /* Prototypes */
00060 
00061 void polygon_init (void);
00062 Cardinal polygon_point_idx (PolygonType * polygon, PointType * point);
00063 Cardinal polygon_point_contour (PolygonType * polygon, Cardinal point);
00064 Cardinal prev_contour_point (PolygonType * polygon, Cardinal point);
00065 Cardinal next_contour_point (PolygonType * polygon, Cardinal point);
00066 Cardinal GetLowestDistancePolygonPoint (PolygonType *,
00067                                         Coord, Coord);
00068 bool RemoveExcessPolygonPoints (LayerType *, PolygonType *);
00069 void GoToPreviousPoint (void);
00070 void ClosePolygon (void);
00071 void CopyAttachedPolygonToLayer (void);
00072 int PolygonHoles (PolygonType *ptr, const BoxType *range,
00073                   int (*callback) (PLINE *, void *user_data),
00074                   void *user_data);
00075 int PlowsPolygon (DataType *, int, void *, void *,
00076                   int (*callback) (DataType *, LayerType *, PolygonType *, int, void *, void *, void *),
00077                   void *userdata);
00078 void ComputeNoHoles (PolygonType *poly);
00079 POLYAREA * ContourToPoly (PLINE *);
00080 POLYAREA * PolygonToPoly (PolygonType *);
00081 POLYAREA * RectPoly (Coord x1, Coord x2, Coord y1, Coord y2);
00082 POLYAREA * CirclePoly (Coord x, Coord y, Coord radius);
00083 POLYAREA * OctagonPoly(Coord x, Coord y, Coord radius);
00084 POLYAREA * LinePoly(LineType *l, Coord thick);
00085 POLYAREA * ArcPoly(ArcType *l, Coord thick);
00086 POLYAREA * PinPoly(PinType *l, Coord thick, Coord clear);
00087 POLYAREA * BoxPolyBloated (BoxType *box, Coord radius);
00088 void frac_circle (PLINE *, Coord, Coord, Vector, int);
00089 int InitClip(DataType *d, LayerType *l, PolygonType *p);
00090 void RestoreToPolygon(DataType *, int, void *, void *);
00091 void ClearFromPolygon(DataType *, int, void *, void *);
00092 
00093 bool IsPointInPolygon (Coord, Coord, Coord, PolygonType *);
00094 bool IsPointInPolygonIgnoreHoles (Coord, Coord, PolygonType *);
00095 bool IsRectangleInPolygon (Coord, Coord, Coord, Coord, PolygonType *);
00096 bool isects (POLYAREA *, PolygonType *, bool);
00097 bool MorphPolygon (LayerType *, PolygonType *);
00098 void NoHolesPolygonDicer (PolygonType *p, const BoxType *clip,
00099                           void (*emit) (PLINE *, void *), void *user_data);
00100 void PolyToPolygonsOnLayer (DataType *, LayerType *, POLYAREA *, FlagType);
00101 
00102 #endif