TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
coupling.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
#pragma once
3
// Coupled segments of a differential pair, as KiCad 10.0.6's diff-pair coupling test finds them
4
// (pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp, doc 05 §59): a track of the P net and one of the N net on the same
5
// layer are coupled where they run on parallel, distinct lines and their projections overlap. The gap is measured between the
6
// overlapping parts, edge to edge. Integer arithmetic follows KiCad's SEG (rounded rescale, truncated square root), so the
7
// gap is KiCad's to the nanometre.
8
9
#include <optional>
10
11
#include "
model/board.hpp
"
12
13
namespace
tmk::drc
{
14
15
struct
Coupling
{
16
model::Point
pa
,
pb
,
na
,
nb
;
// the overlapping parts of the P and N centrelines
17
model::Point
near_p
,
near_n
;
// their nearest points
18
Coord
gap
= 0;
// edge to edge: centreline distance minus the half widths
19
Coord
length
= 0;
// length of the N part, rounded
20
};
21
22
// The two centrelines (a P track from p0 to p1 of width wp, an N track likewise) coupled as KiCad couples them, or nothing: both
23
// longer than about 1 nm, exactly parallel (a zero cross product) and not collinear, with overlapping projections.
24
std::optional<Coupling>
couple
(
model::Point
p0,
model::Point
p1,
Coord
wp,
model::Point
n0,
model::Point
n1,
Coord
wn);
25
26
}
// namespace tmk::drc
board.hpp
The board model (design doc 02 §3): every object TraceMaker reads from a .kicad_pcb,...
tmk::drc
Definition
connectivity.hpp:13
tmk::drc::couple
std::optional< Coupling > couple(model::Point p0, model::Point p1, Coord wp, model::Point n0, model::Point n1, Coord wn)
The two centrelines (a P track from p0 to p1 of width wp, an N track likewise) coupled as KiCad coupl...
tmk::Coord
std::int64_t Coord
Engine coordinate: signed 64-bit nanometres.
Definition
units.hpp:12
tmk::drc::Coupling
Definition
coupling.hpp:15
tmk::drc::Coupling::near_p
model::Point near_p
Definition
coupling.hpp:17
tmk::drc::Coupling::pa
model::Point pa
Definition
coupling.hpp:16
tmk::drc::Coupling::length
Coord length
length of the N part, rounded
Definition
coupling.hpp:19
tmk::drc::Coupling::near_n
model::Point near_n
their nearest points
Definition
coupling.hpp:17
tmk::drc::Coupling::pb
model::Point pb
Definition
coupling.hpp:16
tmk::drc::Coupling::gap
Coord gap
edge to edge: centreline distance minus the half widths
Definition
coupling.hpp:18
tmk::drc::Coupling::na
model::Point na
Definition
coupling.hpp:16
tmk::drc::Coupling::nb
model::Point nb
the overlapping parts of the P and N centrelines
Definition
coupling.hpp:16
tmk::geom::Point
Definition
point.hpp:13
drc
coupling.hpp
Generated by
1.15.0