Distance between a point and a line

BlitzMax Forums/BlitzMax Programming/Distance between a point and a line

ima747(Posted 2008) [#1]
I need to find the distance from a point to a line.

using the math I found at
http://local.wasp.uwa.edu.au/~pbourke/geometry/pointline/

I came up with
distance = ( (Point.X - LineStart.X)*(LineEnd.X - LineStart.X) + (Point,Y - LineStart.Y)*(LineEnd.Y - LineStart.Y) ) / Sqr( (LineEnd.X-LineStart.X)*(LineEnd.X-LineStart.X) - (LineEnd.Y-LineStart.Y)*(LineEnd.Y-LineStart.Y) )


But all it gets me is the distance from the linestart. The math is making my head spin, does anyone have a function or non-broken equation for this?


Jesse(Posted 2008) [#2]
try this:
http://www.blitzmax.com/codearcs/codearcs.php?code=2052


ima747(Posted 2008) [#3]
Your mastery of the codearcs has made me a very happy person, my searching ability is just as bad as my math is seems.