Creepy-simulation
 
Loading...
Searching...
No Matches
DistanceFunc Namespace Reference

Namespace containing distance calculation functions and types. More...

Classes

struct  PolarPoint
 

Enumerations

enum class  Type : std::uint8_t { Euclid , Polar , Manhattan }
 Enumerates supported distance calculation types. More...
 

Functions

double euclideanSquared (const Point &p1, const Point &p2)
 Computes the squared Euclidean distance between two points.
 
double manhattanSquared (const Point &p1, const Point &p2)
 Computes the squared Manhattan distance between two points.
 
double polarSquared (const Point &p1, const Point &p2)
 Computes the squared polar distance between two points.
 
std::function< double(Point p1, Point p2)> funcToType (Type funcType)
 Maps a distance function type to its corresponding function.
 

Detailed Description

Namespace containing distance calculation functions and types.

Enumeration Type Documentation

◆ Type

enum class DistanceFunc::Type : std::uint8_t
strong

Enumerates supported distance calculation types.

Enumerator
Euclid 
Polar 
Manhattan 

Function Documentation

◆ euclideanSquared()

double DistanceFunc::euclideanSquared ( const Point p1,
const Point p2 
)

Computes the squared Euclidean distance between two points.

Parameters
p1The first point.
p2The second point.
Returns
The squared Euclidean distance.

◆ funcToType()

std::function< double(Point p1, Point p2)> DistanceFunc::funcToType ( Type  funcType)

Maps a distance function type to its corresponding function.

Parameters
funcTypeThe type of distance function.
Returns
A function for calculating the specified distance.

◆ manhattanSquared()

double DistanceFunc::manhattanSquared ( const Point p1,
const Point p2 
)

Computes the squared Manhattan distance between two points.

Parameters
p1The first point.
p2The second point.
Returns
The squared Manhattan distance.

◆ polarSquared()

double DistanceFunc::polarSquared ( const Point p1,
const Point p2 
)

Computes the squared polar distance between two points.

Parameters
p1The first point.
p2The second point.
Returns
The squared polar distance.