LineLineIntersect#
- pyCGM2.Math.geometry.LineLineIntersect(p1: ndarray, p2: ndarray, p3: ndarray, p4: ndarray)#
Calculates the line segment pa_pb that is the shortest route between two lines p1_p2 and p3_p4. Calculates also the values of mua and mub where:
pa = p1 + mua (p2 - p1)
pb = p3 + mub (p4 - p3)
- Parameters:
p1 (np.ndarray) – Start point of the first line.
p2 (np.ndarray) – End point of the first line.
p3 (np.ndarray) – Start point of the second line.
p4 (np.ndarray) – End point of the second line.
- Returns:
Tuple[np.ndarray, np.ndarray] – The points pa and pb on the first and second line, respectively, where the shortest line segment intersects each line.
note:
this a python conversion from the code proposed by Paul Bourke at http://astronomy.swin.edu.au/~pbourke/geometry/lineline3d/