I have 4 coodinates (x,y) that mark the 4 corners of a rectangle (not necessarly a square). If I click a point need the “lines” the intersect those points, I need to know which of the coordinate pairs the click was closest to. Did I click nearest the TOP edge? LEFT, BOTTOM or RIGHT … or was I outside of a predetermined tolerance?

The idea is to select an edge, without have to hit the “line” exactly… just gotta be reasonable close

actually headed that direction… In reality it is more than a “square” it is actually a “grid”
so I am going to take my click Point § and find the Horizontal line and vertical line the is closest (abs(delta)
once I have those two line… the sign of each delta will tell me what side of the line the point is on

just need to decide what do to if the distance from top and left are equal…

[quote=416475:@Tim Hare]Calculate the distance using the good old Pythagorean formula a^2 + b^2 = c^2.
c is the distance.
a is abs(x1 - x2), b is abs(y1 - y2).[/quote]
No need to be that expensive. What Greg mentioned (with some expansion) works just fine… Since the lines are horizontal and vertical, and I’m not looking for the distance to a specific point

Nah… when the user clicks on the grid… In needed to know which horizontal or vertical line (and what square) was clicked…
so for example … Cell(5,3) Top Side