Determining points inside the MKAD API Yandex?

Good day, please help with one function inPoly(x,y)
she incorrectly identifies whether the address is inside the ring road, all addresses are defined as outside the MKAD

function inPoly( x, y ){
 let j = mkad_points.length - 1,
 c = false; // true/false - inside or outside the polygon
 for (i = 0; i < mkad_points.length; i++){
 if ((((mkad_points[i][1]<=y) && (y<mkad_points[j][1])) || ((mkad_points[j][1]<=y) && (y<mkad_points[i][1]))) && (x > (mkad_points[j][0] - mkad_points[i][0]) * (y - mkad_points[i][1]) / (mkad_points[j][1] - mkad_points[i][1]) + mkad_points[i][0])) {
 c = !c
}
 j = i;
}
 return c;
}


the array of points MKAD
let mkad_points = [
[55.78000432402266,37.84172564285271],
[55.775874525970494,37.8381207618713],
[55.775626746008065,37.83979446823122],
[55.77446586811748,37.84243326983639],
..........
[55.79131399999368,37.840581150787344],
[55.78000432402266,37.84172564285271]
 ];


All coordinates mkad_points do not fit (they are on the link pastebin.com/raw/DKgMrxqF)

The coordinates of a point inside the ring road 37.499893 55.718872

If you pass them to the function inPoly (x, y ) get false
Even if we take for example the last of mkap_point 55.78000432402266,37.84172564285271
and to pass to the function is still false
April 3rd 20 at 18:54
1 answer
April 3rd 20 at 18:56
Ops issue is to remove incorrectly passed the coordinates of the point ))
inPoly (55.718872, 37.499893 ) - correct

Find more questions by tags APIYandex.Maps