KiCad PCB EDA Suite
filled_circle_2d.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) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
5  * Copyright (C) 1992-2020 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 
29 #ifndef _FILLED_CIRCLE_2D_H_
30 #define _FILLED_CIRCLE_2D_H_
31 
32 #include "object_2d.h"
33 
35 {
36 public:
37  FILLED_CIRCLE_2D( const SFVEC2F& aCenter, float aRadius, const BOARD_ITEM& aBoardItem );
38 
39  float GetRadius() const { return m_radius; }
40  const SFVEC2F& GetCenter() const { return m_center; }
41  float GetRadiusSquared() const { return m_radius_squared; }
42 
43  bool Overlaps( const BBOX_2D& aBBox ) const override;
44  bool Intersects( const BBOX_2D& aBBox ) const override;
45  bool Intersect( const RAYSEG2D& aSegRay, float* aOutT, SFVEC2F* aNormalOut ) const override;
46  INTERSECTION_RESULT IsBBoxInside( const BBOX_2D& aBBox ) const override;
47  bool IsPointInside( const SFVEC2F& aPoint ) const override;
48 
49 private:
51  float m_radius;
53 };
54 
55 
56 #endif // _FILLED_CIRCLE_2D_H_
float GetRadius() const
INTERSECTION_RESULT IsBBoxInside(const BBOX_2D &aBBox) const override
Test this object if it's completely outside, intersects, or is completely inside aBBox.
const SFVEC2F & GetCenter() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
bool Intersect(const RAYSEG2D &aSegRay, float *aOutT, SFVEC2F *aNormalOut) const override
glm::vec2 SFVEC2F
Definition: xv3d_types.h:42
INTERSECTION_RESULT
Definition: object_2d.h:36
FILLED_CIRCLE_2D(const SFVEC2F &aCenter, float aRadius, const BOARD_ITEM &aBoardItem)
Manage a bounding box defined by two SFVEC2F min max points.
Definition: bbox_2d.h:41
bool Intersects(const BBOX_2D &aBBox) const override
a.Intersects(b) ⇔ !a.Disjoint(b) ⇔ !(a ∩ b = ∅)
bool Overlaps(const BBOX_2D &aBBox) const override
Test if the box overlaps the object.
bool IsPointInside(const SFVEC2F &aPoint) const override
float GetRadiusSquared() const
Definition: ray.h:105