20#ifndef SNAP_MANIFOLD_H
21#define SNAP_MANIFOLD_H
40 [&](
const auto& aShape ) ->
double
42 using MANIFOLD_TYPE = std::decay_t<
decltype( aShape )>;
44 if constexpr( std::is_same_v<MANIFOLD_TYPE, LINE> )
45 return aShape.Distance( aPoint );
46 else if constexpr( std::is_same_v<MANIFOLD_TYPE, HALF_LINE> )
47 return aShape.NearestPoint( aPoint ).Distance( aPoint );
48 else if constexpr( std::is_same_v<MANIFOLD_TYPE, SEG> )
49 return aShape.Distance( aPoint );
50 else if constexpr( std::is_same_v<MANIFOLD_TYPE, CIRCLE> )
51 return std::abs( aShape.Center.Distance( aPoint ) - aShape.Radius );
52 else if constexpr( std::is_same_v<MANIFOLD_TYPE, SHAPE_ARC> )
53 return aShape.NearestPoint( aPoint ).Distance( aPoint );
double Distance(const VECTOR2< extended_type > &aVector) const
Compute the distance between two vectors.
std::variant< LINE, HALF_LINE, SEG, CIRCLE, SHAPE_ARC, SHAPE_ELLIPSE, BOX2I > INTERSECTABLE_GEOM
A variant type that can hold any of the supported geometry types for intersection calculations.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
VECTOR2I GetNearestPoint(const NEARABLE_GEOM &aGeom, const VECTOR2I &aPt)
Get the nearest point on a geometry to a given point.
std::variant< LINE, HALF_LINE, SEG, CIRCLE, SHAPE_ARC, SHAPE_ELLIPSE, BOX2I, VECTOR2I > NEARABLE_GEOM
A variant type that can hold any of the supported geometry types for nearest point calculations.
double snapManifoldDistance(const INTERSECTABLE_GEOM &aGeometry, const VECTOR2I &aPoint)
Distance from a point to the nearest point of a snap manifold shape.
VECTOR2< int32_t > VECTOR2I