pyCGM_Single.pycgmKinetics.pnt2line

pyCGM_Single.pycgmKinetics.pnt2line(pnt, start, end)

Calculate shortest distance between a point and line.

The line is represented by the points start and end.

Parameters
pntlist

An (x, y, z) coordinate point.

startlist

An (x, y, z) point on the line.

endlist

An (x, y, z) point on the line.

Returns
dist, nearest, pnttuple (float, list, list)

Returns dist, the closest distance from the point to the line, Returns nearest, the closest point on the line from the given pnt as a 1x3 array, Returns pnt, the original given pnt as a 1x3 array.

Examples

>>> import numpy as np
>>> from .pycgmKinetics import pnt2line
>>> pnt = [1, 2, 3]
>>> start = [4, 2, 3]
>>> end = [2, 2, 3]
>>> pnt2line(pnt, start, end)
(1.0, (2.0, 2.0, 3.0), [1, 2, 3])