KiCad PCB EDA Suite
Loading...
Searching...
No Matches
intersection.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 The KiCad Developers, see AUTHORS.txt for contributors.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, you may find one here:
18
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19
* or you may search the http://www.gnu.org website for the version 2 license,
20
* or you may write to the Free Software Foundation, Inc.,
21
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22
*/
23
24
#pragma once
25
26
#include <variant>
27
#include <vector>
28
29
#include <
math/vector2d.h
>
30
#include <
math/box2.h
>
31
32
#include <
geometry/circle.h
>
33
#include <
geometry/half_line.h
>
34
#include <
geometry/line.h
>
35
#include <
geometry/seg.h
>
36
#include <
geometry/shape_arc.h
>
37
#include <
geometry/shape_rect.h
>
38
43
using
INTERSECTABLE_GEOM
= std::variant<LINE, HALF_LINE, SEG, CIRCLE, SHAPE_ARC, BOX2I>;
44
52
struct
INTERSECTION_VISITOR
53
{
54
public
:
60
INTERSECTION_VISITOR
(
const
INTERSECTABLE_GEOM
& aOtherGeometry,
61
std::vector<VECTOR2I>& aIntersections );
62
63
/*
64
* One of these operator() overloads will be called by std::visit
65
* as needed to visit (i.e. intersect) the geometry with the (stored)
66
* other geometry.
67
*/
68
void
operator()
(
const
SEG
& aSeg )
const
;
69
void
operator()
(
const
LINE
& aLine )
const
;
70
void
operator()
(
const
HALF_LINE
& aLine )
const
;
71
void
operator()
(
const
CIRCLE
& aCircle )
const
;
72
void
operator()
(
const
SHAPE_ARC
& aArc )
const
;
73
void
operator()
(
const
BOX2I
& aArc )
const
;
74
75
private
:
76
const
INTERSECTABLE_GEOM
&
m_otherGeometry
;
77
std::vector<VECTOR2I>&
m_intersections
;
78
};
box2.h
BOX2I
BOX2< VECTOR2I > BOX2I
Definition
box2.h:922
circle.h
CIRCLE
Represent basic circle geometry with utility geometry functions.
Definition
circle.h:33
HALF_LINE
Definition
half_line.h:41
LINE
Definition
line.h:36
SEG
Definition
seg.h:42
SHAPE_ARC
Definition
shape_arc.h:40
half_line.h
INTERSECTABLE_GEOM
std::variant< LINE, HALF_LINE, SEG, CIRCLE, SHAPE_ARC, BOX2I > INTERSECTABLE_GEOM
A variant type that can hold any of the supported geometry types for intersection calculations.
Definition
intersection.h:43
line.h
seg.h
shape_arc.h
shape_rect.h
INTERSECTION_VISITOR::m_otherGeometry
const INTERSECTABLE_GEOM & m_otherGeometry
Definition
intersection.h:76
INTERSECTION_VISITOR::INTERSECTION_VISITOR
INTERSECTION_VISITOR(const INTERSECTABLE_GEOM &aOtherGeometry, std::vector< VECTOR2I > &aIntersections)
Definition
intersection.cpp:201
INTERSECTION_VISITOR::m_intersections
std::vector< VECTOR2I > & m_intersections
Definition
intersection.h:77
INTERSECTION_VISITOR::operator()
void operator()(const SEG &aSeg) const
Definition
intersection.cpp:216
vector2d.h
src
libs
kimath
include
geometry
intersection.h
Generated on Sun Sep 21 2025 01:05:26 for KiCad PCB EDA Suite by
1.13.2