Namespace distances

namespace distances

Compute distances between points.

Functions for computing distances between points in 3D space.

Author
Oliver Laslett
Date
2017

Functions

std::vector<std::vector<std::array<double, 3>>> pair_wise_distance_vectors(std::vector<std::array<double, 3>> points)

Computes the distance vector between points in 3d space.

Given a list of x,y,z coordinates, compute the distance vector between every pair of x,y,z coordinates in the list.

Return
NxN std::vector matrix of distances between each pair of points
Parameters
  • points: length N vector of arrays of x,y,z coordinates

std::vector<std::vector<double>> pair_wise_distance_magnitude(std::vector<std::array<double, 3>> points)

Computes the Euclidean distance between pairs of points.

std::vector<std::vector<std::array<double, 3>>> pair_wise_distance_unit_vectors(std::vector<std::array<double, 3>> points)

Computes the unit distance vector between a list of points.

std::vector<std::vector<double>> pair_wise_distance_magnitude(std::vector<std::vector<std::array<double, 3>>> distance_vectors)

Computes the Euclidean distance from a matrix of distance vectors.

Given a matrix of distance vectors, compute the 2norm of the vector corresponding to the Euclidean distance.

Return
NxN matrix of Euclidean distance values
Parameters
  • distance_vectors: NxN symmetrical matrix of distance vectors (x,y,z coordinates)

std::vector<std::vector<std::array<double, 3>>> pair_wise_distance_unit_vectors(std::vector<std::vector<std::array<double, 3>>> distance_vectors, std::vector<std::vector<double>> distance_magnitudes)

Computes the unit distance vectors from distance vectors and their magnitudes.