I need a basic function to find the shortest distance between a point and a line segment. Feel free to …