I originally posted this over at stackoverflow and they suggested asking it over here.
Text of original:
I am working on implementing a clustering algorithm in C++. Specifically, this algorithm: http://www.cs.uiuc.edu/~hanj/pdf/sigmod07_jglee.pdf
At one point in the algorithm (sec 3.2 p4-5), I am to calculate perpendicular and angular distance (d┴ and dθ) between two line segments: p1 to p2, p1 to p3.
It has been a while since I had a math class, I am kinda shaky on what these actually are conceptually and how to calculate them. Can anyone help?
It looks like I can calculate the perpendicular distance by the following (d1^3 + d2^3) / (d1^2 + d2^2), where d1 is the euclidean distance between the starting points and d2 is the euclidean distance between the ending points. How would I calculate euclidean distances though?
The angular distance looks to be calculated by the dot product of the vectors. It has been about 10 years since linear algebra so I am very rusty on this but I think I can get a handle on this one hopefully. Just a bit unsure of how to conceptually transfer line segments to vectors.
Anyway, any help you all could offer would be greatly appreciated.