2
$\begingroup$

Let P be an arbitrary point. Let S be a segment.

Is there any way of computing the shortest distance between P and S without using cross product?

I found a formula that uses cross product. However, I need to calculate the distance for millions of points. (~ 100 million points)

I am using MATLAB, and using the profiler I realized that the cross product function is taking most of the computation time.

Any ideas would be greatly appreciated.

2 Answers 2