Class ObstacleGroup

java.lang.Object
me.nabdev.pathfinding.structures.ObstacleGroup

public class ObstacleGroup extends Object
Represents a group of obstacles, which can be used as a janky way to represent concave obstacles.
  • Constructor Details

    • ObstacleGroup

      public ObstacleGroup(Obstacle... obstacles)
      Creates a new obstacle group.
      Parameters:
      obstacles - The obstacles in the group.
  • Method Details

    • isInside

      public boolean isInside(Vertex pos)
      Checks if a vertex is inside any of the obstacles in the group.
      Parameters:
      pos - The vertex to check.
      Returns:
      True if the vertex is inside any of the obstacles, false otherwise.
    • calculateNearestPoint

      public Vertex calculateNearestPoint(Vertex pos)
      Returns the closest point on the obstacles to the given vertex.
      Parameters:
      pos - The vertex to calculate the nearest point to.
      Returns:
      The nearest point on the obstacles to the given vertex.
    • getObstacles

      public ArrayList<Obstacle> getObstacles()
      Returns the obstacles in the group.
      Returns:
      The obstacles in the group.