KiCad PCB EDA Suite
ctriangle2d.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 _CTRIANGLE2D_H_
31 #define _CTRIANGLE2D_H_
32 
33 #include "cobject2d.h"
34 #include "../accelerators/ccontainer2d.h"
37 #include <clipper.hpp>
38 
39 class CTRIANGLE2D : public COBJECT2D
40 {
41 private:
45 
51 
52 public:
53  CTRIANGLE2D ( const SFVEC2F &aV1,
54  const SFVEC2F &aV2,
55  const SFVEC2F &aV3,
56  const BOARD_ITEM &aBoardItem );
57 
58  const SFVEC2F &GetP1() const { return p1; }
59  const SFVEC2F &GetP2() const { return p2; }
60  const SFVEC2F &GetP3() const { return p3; }
61 
62  // Imported from COBJECT2D
63  bool Overlaps( const CBBOX2D &aBBox ) const override;
64  bool Intersects( const CBBOX2D &aBBox ) const override;
65  bool Intersect( const RAYSEG2D &aSegRay, float *aOutT, SFVEC2F *aNormalOut ) const override;
66  INTERSECTION_RESULT IsBBoxInside( const CBBOX2D &aBBox ) const override;
67  bool IsPointInside( const SFVEC2F &aPoint ) const override;
68 };
69 
70 
72  CGENERICCONTAINER2D &aDstContainer,
73  float aBiuTo3DunitsScale,
74  const BOARD_ITEM &aBoardItem );
75 #endif // _CTRIANGLE2D_H_
INTERSECTION_RESULT
Definition: cobject2d.h:38
SFVEC2F p1
Definition: ctriangle2d.h:42
float m_p3x_minus_p2x
Definition: ctriangle2d.h:48
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
Class CBBOX manages a bounding box defined by two SFVEC2F min max points.
Definition: cbbox2d.h:40
float m_p3y_minus_p1y
Definition: ctriangle2d.h:49
const SFVEC2F & GetP1() const
Definition: ctriangle2d.h:58
INTERSECTION_RESULT IsBBoxInside(const CBBOX2D &aBBox) const override
Function IsBBoxInside.
Definition: ctriangle2d.cpp:98
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
bool IsPointInside(const SFVEC2F &aPoint) const override
bool Intersect(const RAYSEG2D &aSegRay, float *aOutT, SFVEC2F *aNormalOut) const override
Function Intersect.
Definition: ctriangle2d.cpp:88
Class SHAPE_POLY_SET.
float m_p1x_minus_p3x
Definition: ctriangle2d.h:50
float m_inv_denominator
Definition: ctriangle2d.h:46
const SFVEC2F & GetP2() const
Definition: ctriangle2d.h:59
SFVEC2F p2
Definition: ctriangle2d.h:43
void Convert_shape_line_polygon_to_triangles(const SHAPE_POLY_SET &aPolyList, CGENERICCONTAINER2D &aDstContainer, float aBiuTo3DunitsScale, const BOARD_ITEM &aBoardItem)
bool Intersects(const CBBOX2D &aBBox) const override
Function Intersects.
Definition: ctriangle2d.cpp:72
CTRIANGLE2D(const SFVEC2F &aV1, const SFVEC2F &aV2, const SFVEC2F &aV3, const BOARD_ITEM &aBoardItem)
Definition: ctriangle2d.cpp:43
const SFVEC2F & GetP3() const
Definition: ctriangle2d.h:60
bool Overlaps(const CBBOX2D &aBBox) const override
Function Overlaps.
Definition: ctriangle2d.cpp:81
float m_p2y_minus_p3y
Definition: ctriangle2d.h:47
SFVEC2F p3
Definition: ctriangle2d.h:44
Definition: ray.h:86