KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ellipse.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef KICAD_ELLIPSE_H
21#define KICAD_ELLIPSE_H
22
23#include <math/vector2d.h>
24#include <geometry/eda_angle.h>
25#include <core/mirror.h>
26
29
30template <typename NumericType>
32{
33public:
35 MajorRadius( 0 ),
36 MinorRadius( 0 )
37 {
38 }
39
51 ELLIPSE( const VECTOR2<NumericType>& aCenter, NumericType aMajorRadius,
52 NumericType aMinorRadius, EDA_ANGLE aRotation, EDA_ANGLE aStartAngle = ANGLE_0,
53 EDA_ANGLE aEndAngle = FULL_CIRCLE );
54
66 ELLIPSE( const VECTOR2<NumericType>& aCenter, const VECTOR2<NumericType>& aMajor, double aRatio,
67 EDA_ANGLE aStartAngle = ANGLE_0, EDA_ANGLE aEndAngle = FULL_CIRCLE );
68
72 void Mirror( const VECTOR2<NumericType>& aRef, FLIP_DIRECTION aFlipDirection );
73
78
84
89
94
100
102 NumericType MajorRadius;
103 NumericType MinorRadius;
107
108};
109
110#endif //KICAD_ELLIPSE_H
NumericType MinorRadius
Definition ellipse.h:103
VECTOR2< NumericType > GetArcEndPoint() const
Get the point on the ellipse at the end angle of the arc.
Definition ellipse.h:93
VECTOR2< NumericType > GetPointAtAngle(EDA_ANGLE angle) const
Get the point on the ellipse at a given angle.
Definition ellipse.cpp:90
EDA_ANGLE Rotation
Definition ellipse.h:104
void Mirror(const VECTOR2< NumericType > &aRef, FLIP_DIRECTION aFlipDirection)
Mirror the ellipse along a horizontal or vertical axis passing through aRef.
Definition ellipse.cpp:54
EDA_ANGLE StartAngle
Definition ellipse.h:105
ELLIPSE()
Definition ellipse.h:34
VECTOR2< NumericType > GetArcStartPoint() const
Get the point on the ellipse at the start angle of the arc.
Definition ellipse.h:88
NumericType MajorRadius
Definition ellipse.h:102
EDA_ANGLE EndAngle
Definition ellipse.h:106
EDA_ANGLE GetAngleAtPoint(const VECTOR2< NumericType > &aPt) const
Get the parametric angle of a point on the ellipse.
Definition ellipse.cpp:109
VECTOR2< NumericType > Center
Definition ellipse.h:101
EDA_ANGLE GetSubtendedAngle() const
Get the subtended angle of the ellipse or elliptical arc at the center.
Definition ellipse.cpp:82
Define a general 2D-vector/point.
Definition vector2d.h:67
static constexpr EDA_ANGLE ANGLE_0
Definition eda_angle.h:411
static constexpr EDA_ANGLE FULL_CIRCLE
Definition eda_angle.h:409
FLIP_DIRECTION
Definition mirror.h:23