coords.Coords.distance_to_line#
- Coords.distance_to_line(p, n)#
Returns the distance of all points to the line (p,n).
Parameters#
- p: float array_like with shape (3,) or (1,3)
Coordinates of some point on the line.
- n: float array_like with shape (3,) or (1,3)
Vector specifying the direction of the line.
Returns#
- float array
Array with shape
points_shape()holding the distance of each point to the line through p and having direction n. All values are positive or zero.
Examples#
>>> X = Coords([[0.,0.,0.],[2.,0.,0.],[1.,3.,0.],[-1.,0.,0.]]) >>> print(X.distance_to_line([0.,0.,0.],[1.,1.,0.])) [0. 1.4142 1.4142 0.7071]