I have this code here to find out if there is a line in a circle. (Perhaps you can use this to answer your question)
Maps.ui.inCircle = function(l1, l2, c, r){ var a = l1.lat() - l2.lat() var b = l1.lng() - l2.lng() var x = Math.sqrt(a*a + b*b) return (Math.abs((c.lat() - l1.lat()) * (l2.lng() - l1.lng()) - (c.lng() - l1.lng()) * (l2.lat() - l1.lat())) / x <= r); }
This works great for this. But now I need to find out if the point is in the area around the line. For example, the blue dots in this will return true, and the purple lines I will return. But not green lines or dots. I also need to find out if the line passes through the line.

Here is my code to see if a line crosses this line:
function getLineIntersaction(y1,x1,y2,x2, y3,x3,y4,x4){ if (Math.max(X1,X2) < Math.min(X3,X4)) // This means no same coordinates return false; m1 = (y1-y2)/(x1-x2); m2 = (y3-y4)/(x3-x4); c1 = y1-m1x1; c2 = y3-m2x3; if(m1=m2)//segments are parallel. return false; var x = (c1-c2)/(m2-m1); if(!isNaN(x) && isFinite(x)){ if( x < Math.max(Math.min(x1,x2),math.min(x3,x4)) || x > Math.min(Math.max(x1,x2),Math.max(x3,x4))) return false; else return true; } return false; }
So this needs to be integrated with other code.
How can i do this? I could pass the line function, or I could pass only one point to it.
If the string is passed, we will run the above function. I want it to return an array. The first element of the array will return if it is next to it (in the red area), and the second element in the array will return if the segment cuts the line. Meaning, if it is just a point, then the second element will always be false.
Question
How to determine if a line or point is in the red area?