KiCad PCB EDA Suite
Loading...
Searching...
No Matches
4pt_polygon_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
25
26#ifndef _POLYGON_4PT_2D_H_
27#define _POLYGON_4PT_2D_H_
28
29#include "object_2d.h"
30
38{
39public:
40 POLYGON_4PT_2D( const SFVEC2F& v1, const SFVEC2F& v2, const SFVEC2F& v3, const SFVEC2F& v4,
41 const BOARD_ITEM& aBoardItem );
42
43 const SFVEC2F& GetV0() const { return m_segments[0]; }
44 const SFVEC2F& GetV1() const { return m_segments[1]; }
45 const SFVEC2F& GetV2() const { return m_segments[2]; }
46 const SFVEC2F& GetV3() const { return m_segments[3]; }
47
48 const SFVEC2F& GetN0() const { return m_seg_normal[0]; }
49 const SFVEC2F& GetN1() const { return m_seg_normal[1]; }
50 const SFVEC2F& GetN2() const { return m_seg_normal[2]; }
51 const SFVEC2F& GetN3() const { return m_seg_normal[3]; }
52
53 bool Overlaps( const BBOX_2D& aBBox ) const override;
54 bool Intersects( const BBOX_2D& aBBox ) const override;
55 bool Intersect( const RAYSEG2D& aSegRay, float* aOutT, SFVEC2F* aNormalOut ) const override;
56 INTERSECTION_RESULT IsBBoxInside( const BBOX_2D& aBBox ) const override;
57 bool IsPointInside( const SFVEC2F& aPoint ) const override;
58
59private:
63};
64
65
66#endif // _POLYGON_4PT_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
const SFVEC2F & GetV3() const
bool Intersect(const RAYSEG2D &aSegRay, float *aOutT, SFVEC2F *aNormalOut) const override
bool Intersects(const BBOX_2D &aBBox) const override
a.Intersects(b) ⇔ !a.Disjoint(b) ⇔ !(a ∩ b = ∅)
const SFVEC2F & GetV0() const
SFVEC2F m_precalc_slope[4]
const SFVEC2F & GetN1() const
const SFVEC2F & GetV1() const
SFVEC2F m_seg_normal[4]
bool IsPointInside(const SFVEC2F &aPoint) const override
const SFVEC2F & GetN0() 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 & GetN2() const
const SFVEC2F & GetV2() const
SFVEC2F m_segments[4]
POLYGON_4PT_2D(const SFVEC2F &v1, const SFVEC2F &v2, const SFVEC2F &v3, const SFVEC2F &v4, const BOARD_ITEM &aBoardItem)
const SFVEC2F & GetN3() const
bool Overlaps(const BBOX_2D &aBBox) const override
Test if the box overlaps the object.
INTERSECTION_RESULT
Definition object_2d.h:33
Manage a bounding box defined by two SFVEC2F min max points.
Definition bbox_2d.h:38
VECTOR3I v1(5, 5, 5)
VECTOR2I v2(1, 0)
VECTOR2I v4(1, 1)
VECTOR2I v3(-2, 1)
glm::vec2 SFVEC2F
Definition xv3d_types.h:38