Пример #1
0
 @Override
 public boolean relaxOperatingArea(Point point, Direction direction, int miles) {
   OperatingAreaRelaxation relaxation = OperatingAreaRelaxation.getInstance();
   Polygon p = relaxation.relax(this.ploygon, direction, miles);
   if (p.contains(point)) {
     return true;
   }
   return false;
 }
Пример #2
0
  @Override
  public double getShortestDistanceToBoundary(Point point) {

    Point[] points = ploygon.getPoints();
    double[] x_coord = new double[points.length];
    double[] y_coord = new double[points.length];
    for (int i = 0; i < points.length; i++) {
      x_coord[i] = points[i].x();
      y_coord[i] = points[i].y();
    }
    SimplePolygon2D polygon2D = new SimplePolygon2D(x_coord, y_coord);
    return polygon2D.distance(point.x(), point.y());
  }
Пример #3
0
  @Override
  public boolean isCovered(Point point) {

    return ploygon.contains(point);
  }