public boolean checkPointPath(int x,int y,Point point){
    //first check if point is in the triangle bounded by locations[x] and locations[y]
    double minx=min(locations[x].getPoint().getX(),locations[y].getPoint().getX());
    double maxx=max(locations[x].getPoint().getX(),locations[y].getPoint().getX());
    double miny=min(locations[x].getPoint().getY(),locations[y].getPoint().getY());
    double maxy=max(locations[x].getPoint().getY(),locations[y].getPoint().getY());
    if((point.getX()<=maxx) && (point.getX()>=minx) && (point.getY()<=maxy) && (point.getY()>=miny)){
    }else{
     return false; 
    }
    
    double slope=0;
    double newy;
    //Find the point on the line with same x
    double diff=maxx-minx;
    diff=(diff>0)?diff:(-diff);
    if(diff<=4){
      return true;
    }else{
      slope=(locations[y].getPoint().getY()-locations[x].getPoint().getY())/(locations[y].getPoint().getX()-locations[x].getPoint().getX());
      newy=locations[x].getPoint().getY()+slope*(point.getX()-locations[x].getPoint().getX());
      slope=(slope>0)?slope:(-slope);
      if((point.getY()<=(newy+slope*10))&&(point.getY()>=(newy-slope*10))){
       return true; 
      }else{
       return false; 
      }
    }
  }