KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 <[email protected]>
5 * Copyright The 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, see <https://www.gnu.org/licenses/>.
19 */
20
24
25#ifndef _RING_2D_H_
26#define _RING_2D_H_
27
28#include "object_2d.h"
29
30class RING_2D : public OBJECT_2D
31{
32public:
33 RING_2D( const SFVEC2F& aCenter, float aInnerRadius, float aOuterRadius,
34 const BOARD_ITEM& aBoardItem );
35
36 bool Overlaps( const BBOX_2D& aBBox ) const override;
37 bool Intersects( const BBOX_2D& aBBox ) const override;
38 bool Intersect( const RAYSEG2D& aSegRay, float* aOutT, SFVEC2F* aNormalOut ) const override;
39 INTERSECTION_RESULT IsBBoxInside( const BBOX_2D& aBBox ) const override;
40 bool IsPointInside( const SFVEC2F& aPoint ) const override;
41
42 const SFVEC2F& GetCenter() const { return m_center; }
43 float GetInnerRadius() const { return m_inner_radius; }
44 float GetOuterRadius() const { return m_outer_radius; }
45
48
49private:
55};
56
57
58#endif // _RING_2D_H_
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:81
OBJECT_2D(OBJECT_2D_TYPE aObjType, const BOARD_ITEM &aBoardItem)
Definition object_2d.cpp:27
bool Intersects(const BBOX_2D &aBBox) const override
a.Intersects(b) ⇔ !a.Disjoint(b) ⇔ !(a ∩ b = ∅)
Definition ring_2d.cpp:61
float GetOuterRadius() const
Definition ring_2d.h:44
float m_outer_radius
Definition ring_2d.h:52
float GetInnerRadius() const
Definition ring_2d.h:43
const SFVEC2F & GetCenter() const
Definition ring_2d.h:42
RING_2D(const SFVEC2F &aCenter, float aInnerRadius, float aOuterRadius, const BOARD_ITEM &aBoardItem)
Definition ring_2d.cpp:31
bool Overlaps(const BBOX_2D &aBBox) const override
Test if the box overlaps the object.
Definition ring_2d.cpp:54
float m_inner_radius
Definition ring_2d.h:51
bool Intersect(const RAYSEG2D &aSegRay, float *aOutT, SFVEC2F *aNormalOut) const override
Definition ring_2d.cpp:68
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:144
float m_inner_radius_squared
Definition ring_2d.h:53
SFVEC2F m_center
Definition ring_2d.h:50
float GetInnerRadiusSquared() const
Definition ring_2d.h:46
float GetOuterRadiusSquared() const
Definition ring_2d.h:47
bool IsPointInside(const SFVEC2F &aPoint) const override
Definition ring_2d.cpp:150
float m_outer_radius_squared
Definition ring_2d.h:54
INTERSECTION_RESULT
Definition object_2d.h:33
Manage a bounding box defined by two SFVEC2F min max points.
Definition bbox_2d.h:38
glm::vec2 SFVEC2F
Definition xv3d_types.h:38