Horizon
Loading...
Searching...
No Matches
convert_basic_shapes_to_polygon.h
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-2021 KiCad Developers, see AUTHORS.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
28#include <geometry/shape_poly_set.h>
30#include <wx/gdicmn.h> // for wxPoint
31
32
33// The chamfer positions of chamfered rect shape.
34// the position is relative to a pad with orientation = 0
35// we can have 1 to 4 chamfered corners (0 corner = roundrect)
36// The position list is the OR of corner to chamfer
37enum RECT_CHAMFER_POSITIONS : int
38{
39 RECT_NO_CHAMFER = 0,
40 RECT_CHAMFER_TOP_LEFT = 1,
41 RECT_CHAMFER_TOP_RIGHT = 2,
42 RECT_CHAMFER_BOTTOM_LEFT = 4,
43 RECT_CHAMFER_BOTTOM_RIGHT = 8,
44 RECT_CHAMFER_ALL = RECT_CHAMFER_BOTTOM_RIGHT
45 | RECT_CHAMFER_BOTTOM_LEFT
46 | RECT_CHAMFER_TOP_RIGHT
47 | RECT_CHAMFER_TOP_LEFT
48};
49
50
62int ConvertArcToPolyline( SHAPE_LINE_CHAIN& aPolyline, VECTOR2I aCenter, int aRadius,
63 double aStartAngleDeg, double aArcAngleDeg, double aAccuracy,
64 ERROR_LOC aErrorLoc );
65
66
78void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const wxPoint& aCenter, int aRadius,
79 int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 );
80
92void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCenter, int aRadius,
93 int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 );
94
95
113void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart,
114 const wxPoint& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc,
115 int aMinSegCount = 0 );
116
131void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer,
132 const wxPoint& aPosition, const wxSize& aSize,
133 double aRotation, int aDeltaX, int aDeltaY, int aInflate,
134 int aError, ERROR_LOC aErrorLoc );
135
159void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer,
160 const wxPoint& aPosition, const wxSize& aSize,
161 double aRotation, int aCornerRadius,
162 double aChamferRatio, int aChamferCorners, int aInflate,
163 int aError, ERROR_LOC aErrorLoc );
164
176void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart,
177 const wxPoint& aMid, const wxPoint& aEnd, int aWidth, int aError,
178 ERROR_LOC aErrorLoc );
179
190void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCentre, int aRadius,
191 int aWidth, int aError, ERROR_LOC aErrorLoc );
192
193#endif // CONVERT_BASIC_SHAPES_TO_POLYGON_H
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Definition shape_line_chain.h:81
Represent a set of closed polygons.
Definition shape_poly_set.h:65
Definition wx_compat.h:40
Definition wx_compat.h:64
a few functions useful in geometry calculations.
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
Definition geometry_utils.h:45