magnet.geometric_utils.project#

magnet.geometric_utils.project(x1: ndarray, x2: ndarray, p: ndarray) float#

Project a point onto a line.

Computes the projection of point p onto the line passing through the points x1, x2.

Parameters:
  • x1 (np.ndarray of float) – Coordinates of the two points defining the line.

  • x2 (np.ndarray of float) – Coordinates of the two points defining the line.

  • p (np.ndarray of float) – Coordinates of the point to project.

Returns:

Projection value.

Return type:

float