KiCad PCB EDA Suite
convert_basic_shapes_to_polygon.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
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.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef CONVERT_BASIC_SHAPES_TO_POLYGON_H
26 #define CONVERT_BASIC_SHAPES_TO_POLYGON_H
27 
32 #include <vector>
33 
34 #include <fctsys.h>
35 #include <trigo.h>
36 #include <macros.h>
37 
39 
40 // The chamfer positions of chamfered rect shape.
41 // the position is relative to a pad with orientation = 0
42 // we can have 1 to 4 chamfered corners (0 corner = roundrect)
43 // The position list is the OR of corner to chamfer
45 {
53 };
54 
55 
66 void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer,
67  wxPoint aCenter, int aRadius,
68  int aCircleToSegmentsCount );
69 
70 
89  wxPoint aStart, wxPoint aEnd, int aWidth,
90  int aCircleToSegmentsCount, double aCorrectionFactor );
91 
92 
103 void GetRoundRectCornerCenters( wxPoint aCenters[4], int aRadius,
104  const wxPoint& aPosition, const wxSize& aSize, double aRotation );
105 
106 
126  const wxPoint& aPosition, const wxSize& aSize,
127  double aRotation, int aCornerRadius,
128  double aChamferRatio, int aChamferCorners,
129  int aCircleToSegmentsCount );
130 
144  wxPoint aStart, wxPoint aEnd,
145  int aCircleToSegmentsCount,
146  int aWidth );
147 
148 
160 void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer,
161  wxPoint aCentre, wxPoint aStart, double aArcAngle,
162  int aCircleToSegmentsCount, int aWidth );
163 
174 void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer,
175  wxPoint aCentre, int aRadius,
176  int aCircleToSegmentsCount, int aWidth );
177 
178 #endif // CONVERT_BASIC_SHAPES_TO_POLYGON_H
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aPosition, const wxSize &aSize, double aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aCircleToSegmentsCount)
convert a rectangle with rounded corners and/or chamfered corners to a polygon Convert rounded corner...
void TransformRoundedEndsSegmentToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aCircleToSegmentsCount, int aWidth)
Function TransformRoundedEndsSegmentToPolygon convert a segment with rounded ends to a polygon Conver...
void TransformOvalClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aWidth, int aCircleToSegmentsCount, double aCorrectionFactor)
convert a oblong shape to a polygon, using multiple segments It is similar to TransformRoundedEndsSeg...
void TransformCircleToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCenter, int aRadius, int aCircleToSegmentsCount)
Function TransformCircleToPolygon convert a circle to a polygon, using multiple straight lines.
This file contains miscellaneous commonly used macros and functions.
Class SHAPE_POLY_SET.
void TransformRingToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCentre, int aRadius, int aCircleToSegmentsCount, int aWidth)
Function TransformRingToPolygon Creates a polygon from a ring Convert arcs to multiple straight segme...
void GetRoundRectCornerCenters(wxPoint aCenters[4], int aRadius, const wxPoint &aPosition, const wxSize &aSize, double aRotation)
Helper function GetRoundRectCornerCenters Has meaning only for rounded rect Returns the centers of th...
void TransformArcToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCentre, wxPoint aStart, double aArcAngle, int aCircleToSegmentsCount, int aWidth)
Function TransformArcToPolygon Creates a polygon from an Arc Convert arcs to multiple straight segmen...