nicetoolbox.utils.linear_algebra

Linear algebra utility functions.

Functions

distance_line_point

Calculate the Euclidean distance from a point to a line in n-dimensional space.

nicetoolbox.utils.linear_algebra.distance_line_point(line_point, line_direction, point)[source]

Calculate the Euclidean distance from a point to a line in n-dimensional space.

Parameters:
  • line_point (numpy.ndarray) – A 2D array representing the coordinates of a point on the line.

  • line_direction (numpy.ndarray) – A 2D array representing the direction vector of the line.

  • point (numpy.ndarray) – A 2D array representing the coordinates of the point.

Returns:

A 2D array containing the Euclidean distance from each

point to the corresponding line.

Return type:

numpy.ndarray

Raises:

AssertionError – If the shapes of line_point, line_direction, or point are inconsistent.