KiCad PCB EDA Suite
Loading...
Searching...
No Matches
nearest.cpp File Reference
#include "geometry/nearest.h"
#include <wx/debug.h>
#include <core/type_helpers.h>
#include <geometry/shape_utils.h>

Go to the source code of this file.

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.
 

Function Documentation

◆ GetNearestPoint() [1/2]

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().

◆ GetNearestPoint() [2/2]

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.

Parameters
aGeomsThe geometries to check.
aPtThe point to find the nearest point to.
Returns
The nearest point on any of the geometries to the given point (or std::nullopt if no geometries were provided).

Definition at line 96 of file nearest.cpp.

References VECTOR2< T >::Distance(), and GetNearestPoint().