KiCad PCB EDA Suite
ring_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 _RING_2D_H_
30 #define _RING_2D_H_
31 
32 #include "object_2d.h"
33 
34 class RING_2D : public OBJECT_2D
35 {
36 public:
37  RING_2D( const SFVEC2F& aCenter, float aInnerRadius, float aOuterRadius,
38  const BOARD_ITEM& aBoardItem );
39 
40  bool Overlaps( const BBOX_2D& aBBox ) const override;
41  bool Intersects( const BBOX_2D& aBBox ) const override;
42  bool Intersect( const RAYSEG2D& aSegRay, float* aOutT, SFVEC2F* aNormalOut ) const override;
43  INTERSECTION_RESULT IsBBoxInside( const BBOX_2D& aBBox ) const override;
44  bool IsPointInside( const SFVEC2F& aPoint ) const override;
45 
46  const SFVEC2F& GetCenter() const { return m_center; }
47  float GetInnerRadius() const { return m_inner_radius; }
48  float GetOuterRadius() const { return m_outer_radius; }
49 
52 
53 private:
59 };
60 
61 
62 #endif // _RING_2D_H_
float m_outer_radius
Definition: ring_2d.h:56
INTERSECTION_RESULT IsBBoxInside(const BBOX_2D &aBBox) const override
Test this object if it's completely outside, intersects, or is completely inside aBBox.
Definition: ring_2d.cpp:148
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
float m_inner_radius
Definition: ring_2d.h:55
float GetInnerRadius() const
Definition: ring_2d.h:47
bool Intersects(const BBOX_2D &aBBox) const override
a.Intersects(b) ⇔ !a.Disjoint(b) ⇔ !(a ∩ b = ∅)
Definition: ring_2d.cpp:65
bool Intersect(const RAYSEG2D &aSegRay, float *aOutT, SFVEC2F *aNormalOut) const override
Definition: ring_2d.cpp:72
SFVEC2F m_center
Definition: ring_2d.h:54
float GetOuterRadius() const
Definition: ring_2d.h:48
glm::vec2 SFVEC2F
Definition: xv3d_types.h:42
INTERSECTION_RESULT
Definition: object_2d.h:36
bool IsPointInside(const SFVEC2F &aPoint) const override
Definition: ring_2d.cpp:154
float GetInnerRadiusSquared() const
Definition: ring_2d.h:50
float m_outer_radius_squared
Definition: ring_2d.h:58
Manage a bounding box defined by two SFVEC2F min max points.
Definition: bbox_2d.h:41
float GetOuterRadiusSquared() const
Definition: ring_2d.h:51
bool Overlaps(const BBOX_2D &aBBox) const override
Test if the box overlaps the object.
Definition: ring_2d.cpp:58
RING_2D(const SFVEC2F &aCenter, float aInnerRadius, float aOuterRadius, const BOARD_ITEM &aBoardItem)
Definition: ring_2d.cpp:35
float m_inner_radius_squared
Definition: ring_2d.h:57
const SFVEC2F & GetCenter() const
Definition: ring_2d.h:46
Definition: ray.h:105