KiCad PCB EDA Suite
cring2d.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-2016 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 
30 #ifndef _CRING2D_H_
31 #define _CRING2D_H_
32 
33 #include "cobject2d.h"
34 
35 class CRING2D : public COBJECT2D
36 {
37 public:
38  const SFVEC2F &GetCenter() const { return m_center; }
39  float GetInnerRadius() const { return m_inner_radius; }
40  float GetOuterRadius() const { return m_outer_radius; }
41 
44 
45 private:
51 
52 public:
53  CRING2D( const SFVEC2F &aCenter, float aInnerRadius, float aOuterRadius,
54  const BOARD_ITEM &aBoardItem );
55 
56  // Imported from COBJECT2D
57  bool Overlaps( const CBBOX2D &aBBox ) const override;
58  bool Intersects( const CBBOX2D &aBBox ) const override;
59  bool Intersect( const RAYSEG2D &aSegRay, float *aOutT, SFVEC2F *aNormalOut ) const override;
60  INTERSECTION_RESULT IsBBoxInside( const CBBOX2D &aBBox ) const override;
61  bool IsPointInside( const SFVEC2F &aPoint ) const override;
62 };
63 
64 
65 #endif // _CRING2D_H_
INTERSECTION_RESULT
Definition: cobject2d.h:38
INTERSECTION_RESULT IsBBoxInside(const CBBOX2D &aBBox) const override
Function IsBBoxInside.
Definition: cring2d.cpp:140
float GetOuterRadiusSquared() const
Definition: cring2d.h:43
float m_outer_radius
Definition: cring2d.h:48
float GetInnerRadiusSquared() const
Definition: cring2d.h:42
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
SFVEC2F m_center
Definition: cring2d.h:46
Class CBBOX manages a bounding box defined by two SFVEC2F min max points.
Definition: cbbox2d.h:40
float m_outer_radius_squared
Definition: cring2d.h:50
float m_inner_radius_squared
Definition: cring2d.h:49
bool IsPointInside(const SFVEC2F &aPoint) const override
Definition: cring2d.cpp:185
const SFVEC2F & GetCenter() const
Definition: cring2d.h:38
float GetOuterRadius() const
Definition: cring2d.h:40
CRING2D(const SFVEC2F &aCenter, float aInnerRadius, float aOuterRadius, const BOARD_ITEM &aBoardItem)
Definition: cring2d.cpp:35
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
bool Overlaps(const CBBOX2D &aBBox) const override
Function Overlaps.
Definition: cring2d.cpp:58
float m_inner_radius
Definition: cring2d.h:47
bool Intersects(const CBBOX2D &aBBox) const override
Function Intersects.
Definition: cring2d.cpp:65
float GetInnerRadius() const
Definition: cring2d.h:39
bool Intersect(const RAYSEG2D &aSegRay, float *aOutT, SFVEC2F *aNormalOut) const override
Function Intersect.
Definition: cring2d.cpp:72
Definition: ray.h:86