KiCad PCB EDA Suite
|
#include <variant>
#include <vector>
#include <math/vector2d.h>
#include <math/box2.h>
#include <geometry/circle.h>
#include <geometry/half_line.h>
#include <geometry/line.h>
#include <geometry/seg.h>
#include <geometry/shape_arc.h>
Go to the source code of this file.
Typedefs | |
using | NEARABLE_GEOM = std::variant< LINE, HALF_LINE, SEG, CIRCLE, SHAPE_ARC, BOX2I, VECTOR2I > |
A variant type that can hold any of the supported geometry types for nearest point calculations. | |
Functions | |
VECTOR2I | GetNearestPoint (const NEARABLE_GEOM &aGeom, const VECTOR2I &aPt) |
Get the nearest point on a geometry to a given point. | |
OPT_VECTOR2I | GetNearestPoint (const std::vector< NEARABLE_GEOM > &aGeoms, const VECTOR2I &aPt) |
Get the nearest point on any of a list of geometries to a given point. | |
VECTOR2I GetNearestPoint | ( | const NEARABLE_GEOM & | aGeom, |
const VECTOR2I & | aPt | ||
) |
Get the nearest point on a geometry to a given point.
Definition at line 58 of file nearest.cpp.
Referenced by PCB_GRID_HELPER::BestSnapAnchor(), and GetNearestPoint().
OPT_VECTOR2I GetNearestPoint | ( | const std::vector< NEARABLE_GEOM > & | aGeoms, |
const VECTOR2I & | aPt | ||
) |
Get the nearest point on any of a list of geometries to a given point.
aGeoms | The geometries to check. |
aPt | The point to find the nearest point to. |
Definition at line 96 of file nearest.cpp.
References VECTOR2< T >::Distance(), and GetNearestPoint().