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, see <https://www.gnu.org/licenses/>.
18
*/
19
20
#pragma once
21
22
#include <variant>
23
#include <vector>
24
25
#include <
math/vector2d.h
>
26
#include <
math/box2.h
>
27
28
#include <
geometry/circle.h
>
29
#include <
geometry/half_line.h
>
30
#include <
geometry/line.h
>
31
#include <
geometry/seg.h
>
32
#include <
geometry/shape_arc.h
>
33
#include <
geometry/shape_rect.h
>
34
39
using
INTERSECTABLE_GEOM
= std::variant<LINE, HALF_LINE, SEG, CIRCLE, SHAPE_ARC, BOX2I>;
40
48
struct
INTERSECTION_VISITOR
49
{
50
public
:
56
INTERSECTION_VISITOR
(
const
INTERSECTABLE_GEOM
& aOtherGeometry,
57
std::vector<VECTOR2I>& aIntersections );
58
59
/*
60
* One of these operator() overloads will be called by std::visit
61
* as needed to visit (i.e. intersect) the geometry with the (stored)
62
* other geometry.
63
*/
64
void
operator()
(
const
SEG
& aSeg )
const
;
65
void
operator()
(
const
LINE
& aLine )
const
;
66
void
operator()
(
const
HALF_LINE
& aLine )
const
;
67
void
operator()
(
const
CIRCLE
& aCircle )
const
;
68
void
operator()
(
const
SHAPE_ARC
& aArc )
const
;
69
void
operator()
(
const
BOX2I
& aArc )
const
;
70
71
private
:
72
const
INTERSECTABLE_GEOM
&
m_otherGeometry
;
73
std::vector<VECTOR2I>&
m_intersections
;
74
};
box2.h
BOX2I
BOX2< VECTOR2I > BOX2I
Definition
box2.h:918
circle.h
CIRCLE
Represent basic circle geometry with utility geometry functions.
Definition
circle.h:33
HALF_LINE
Definition
half_line.h:37
LINE
Definition
line.h:32
SEG
Definition
seg.h:38
SHAPE_ARC
Definition
shape_arc.h:36
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:39
line.h
seg.h
shape_arc.h
shape_rect.h
INTERSECTION_VISITOR::m_otherGeometry
const INTERSECTABLE_GEOM & m_otherGeometry
Definition
intersection.h:72
INTERSECTION_VISITOR::INTERSECTION_VISITOR
INTERSECTION_VISITOR(const INTERSECTABLE_GEOM &aOtherGeometry, std::vector< VECTOR2I > &aIntersections)
Definition
intersection.cpp:197
INTERSECTION_VISITOR::m_intersections
std::vector< VECTOR2I > & m_intersections
Definition
intersection.h:73
INTERSECTION_VISITOR::operator()
void operator()(const SEG &aSeg) const
Definition
intersection.cpp:212
vector2d.h
src
libs
kimath
include
geometry
intersection.h
Generated on Fri Jun 26 2026 00:05:37 for KiCad PCB EDA Suite by
1.13.2