Creepy-simulation
 
Loading...
Searching...
No Matches
utils.hpp File Reference
#include <functional>
#include <random>

Go to the source code of this file.

Classes

struct  Point
 Represents a 2D point with x and y coordinates. More...
 
struct  Rectangle
 Represents a rectangle defined by two points: bottom-left and top-right. More...
 

Namespaces

namespace  DistanceFunc
 Namespace containing distance calculation functions and types.
 

Enumerations

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

Functions

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

Function Documentation

◆ getRandom()

std::mt19937 & getRandom ( )

Retrieves a shared random number generator.

Returns
A reference to the random number generator.