code: function polygonCanSee(polygon, a,b) {
      var p, dist, l1=tmpLine1, l2=tmpLine2;
  
      if (isLeftOn(polygonAt(polygon, a + 1), polygonAt(polygon, a), polygonAt(polygon, b)) && isRightOn(polygonAt(polygon, a - 1), polygonAt(polygon, a), polygonAt(polygon, b))) {
          return false;
      }
      dist = sqdist(polygonAt(polygon, a), polygonAt(polygon, b));
      for (var i = 0; i !== polygon.length; ++i) { // for each edge
          if ((i + 1) % polygon.length === a || i === a){ // ignore incident edges
              continue;
          }
          if (isLeftOn(polygonAt(polygon, a), polygonAt(polygon, b), polygonAt(polygon, i + 1)) && isRightOn(polygonAt(polygon, a), polygonAt(polygon, b), polygonAt(polygon, i))) { // if diag intersects an edge
              l1[0] = polygonAt(polygon, a);
              l1[1] = polygonAt(polygon, b);
              l2[0] = polygonAt(polygon, i);
              l2[1] = polygonAt(polygon, i + 1);
              p = lineInt(l1,l2);
              if (sqdist(polygonAt(polygon, a), p) < dist) { // if edge is blocking visibility to b
                  return false;
              }
          }
      }
  
      return true;
  }
docs: Check if two vertices in the polygon can see each other
  @method canSee
  @param  {Number} a Vertex index 1
  @param  {Number} b Vertex index 2
  @return {Boolean}