KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pns_utils.h
Go to the documentation of this file.
1/*
2 * KiRouter - a push-and-(sometimes-)shove PCB router
3 *
4 * Copyright (C) 2013-2014 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * Author: Tomasz Wlostowski <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#ifndef __PNS_UTILS_H
23#define __PNS_UTILS_H
24
25#include <math/vector2d.h>
26#include <math/box2.h>
27#include <core/minoptmax.h>
30#include <geometry/shape_rect.h>
32
33namespace PNS {
34
35constexpr int HULL_MARGIN = 10;
36
37class ITEM;
38class LINE;
39class DEBUG_DECORATOR;
40class NODE;
41
43
44const SHAPE_LINE_CHAIN ArcHull( const SHAPE_ARC& aSeg, int aClearance, int aWalkaroundThickness );
45
46const SHAPE_LINE_CHAIN OctagonalHull( const VECTOR2I& aP0, const VECTOR2I& aSize,
47 int aClearance, int aChamfer );
48
49const SHAPE_LINE_CHAIN SegmentHull( const SHAPE_SEGMENT& aSeg, int aClearance,
50 int aWalkaroundThickness );
51
60const SHAPE_LINE_CHAIN ConvexHull( const SHAPE_SIMPLE& aConvex, int aClearance );
61
63
64OPT_BOX2I ChangedArea( const ITEM* aItemA, const ITEM* aItemB );
65OPT_BOX2I ChangedArea( const LINE& aLineA, const LINE& aLineB );
66
67void HullIntersection( const SHAPE_LINE_CHAIN& hull, const SHAPE_LINE_CHAIN& line,
69
70const SHAPE_LINE_CHAIN BuildHullForPrimitiveShape( const SHAPE* aShape, int aClearance,
71 int aWalkaroundThickness );
72
73void NodeStats( DEBUG_DECORATOR* aDbg, wxString aLabel, NODE *aNode );
74
79bool SplitAdjacentSegments( NODE* aNode, ITEM* aSeg, const VECTOR2I& aP );
80
85bool SplitAdjacentArcs( NODE* aNode, ITEM* aArc, const VECTOR2I& aP );
86
87const wxString Format( const MINOPTMAX<int> x );
88
89}
90
91
92#endif // __PNS_UTILS_H
std::optional< BOX2I > OPT_BOX2I
Definition box2.h:931
Base class for PNS router board items.
Definition pns_item.h:98
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
Definition pns_line.h:62
Keep the router "world" - i.e.
Definition pns_node.h:243
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
std::vector< INTERSECTION > INTERSECTIONS
Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
An abstract shape on 2D plane.
Definition shape.h:124
Push and Shove diff pair dimensions (gap) settings dialog.
void HullIntersection(const SHAPE_LINE_CHAIN &hull, const SHAPE_LINE_CHAIN &line, SHAPE_LINE_CHAIN::INTERSECTIONS &ips)
constexpr int HULL_MARGIN
Definition pns_utils.h:35
const wxString Format(const MINOPTMAX< int > x)
bool SplitAdjacentSegments(NODE *aNode, ITEM *aSeg, const VECTOR2I &aP)
Snaps the point aP to segment aSeg.
const SHAPE_LINE_CHAIN BuildHullForPrimitiveShape(const SHAPE *aShape, int aClearance, int aWalkaroundThickness)
const SHAPE_LINE_CHAIN OctagonalHull(const VECTOR2I &aP0, const VECTOR2I &aSize, int aClearance, int aChamfer)
Definition pns_utils.cpp:43
SHAPE_RECT ApproximateSegmentAsRect(const SHAPE_SEGMENT &aSeg)
bool SplitAdjacentArcs(NODE *aNode, ITEM *aArc, const VECTOR2I &aP)
Snaps the point aP to arc aArc.
const SHAPE_LINE_CHAIN ArcHull(const SHAPE_ARC &aArc, int aClearance, int aWalkaroundThickness)
Various utility functions.
Definition pns_utils.cpp:74
const SHAPE_LINE_CHAIN ConvexHull(const SHAPE_SIMPLE &aConvex, int aClearance)
Function ConvexHull()
void NodeStats(DEBUG_DECORATOR *dbg, wxString label, PNS::NODE *node)
const SHAPE_LINE_CHAIN SegmentHull(const SHAPE_SEGMENT &aSeg, int aClearance, int aWalkaroundThickness)
OPT_BOX2I ChangedArea(const ITEM *aItemA, const ITEM *aItemB)
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683