KiCad PCB EDA Suite
circle.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) 2021 Roberto Fernandez Bautista <[email protected]>
5 * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef __CIRCLE_H
22#define __CIRCLE_H
23
24#include <math/vector2d.h> // for VECTOR2I
25#include <vector> // for std::vector
26
27class SEG;
28
32class CIRCLE
33{
34public:
35 CIRCLE();
36
37 CIRCLE( const VECTOR2I& aCenter, int aRadius );
38
39 CIRCLE( const CIRCLE& aOther );
40
55 CIRCLE& ConstructFromTanTanPt( const SEG& aLineA, const SEG& aLineB, const VECTOR2I& aP );
56
64 bool Contains( const VECTOR2I& aP ) const;
65
75 VECTOR2I NearestPoint( const VECTOR2I& aP ) const;
76
86 std::vector<VECTOR2I> Intersect( const CIRCLE& aCircle ) const;
87
94 std::vector<VECTOR2I> Intersect( const SEG& aSeg ) const;
95
105 std::vector<VECTOR2I> IntersectLine( const SEG& aLine ) const;
106
113 bool Contains( const VECTOR2I& aP );
114
115 int Radius;
117};
118
119#endif // __CIRCLE_H
120
Represent basic circle geometry with utility geometry functions.
Definition: circle.h:33
VECTOR2I Center
Public to make access simpler.
Definition: circle.h:116
int Radius
Public to make access simpler.
Definition: circle.h:115
std::vector< VECTOR2I > Intersect(const CIRCLE &aCircle) const
Compute the intersection points between this circle and aCircle.
Definition: circle.cpp:209
CIRCLE()
Definition: circle.cpp:30
std::vector< VECTOR2I > IntersectLine(const SEG &aLine) const
Compute the intersection points between this circle and aLine.
Definition: circle.cpp:288
CIRCLE & ConstructFromTanTanPt(const SEG &aLineA, const SEG &aLineB, const VECTOR2I &aP)
Construct this circle such that it is tangent to the given segments and passes through the given poin...
Definition: circle.cpp:51
VECTOR2I NearestPoint(const VECTOR2I &aP) const
Compute the point on the circumference of the circle that is the closest to aP.
Definition: circle.cpp:197
bool Contains(const VECTOR2I &aP) const
Return true if aP is on the circumference of this circle.
Definition: circle.cpp:188
Definition: seg.h:42