Image Environment With Graph
An ImageEnvironment providing an Euclidean2DNavigationGraph. The NaviGator algorithm is used to produce such graph (see generateNavigationGraph). The positions where to plant initial seeds should be specified directly in the image, marking each area of the environment with one or more pixels of a given color (defaults to blue).
Constructors
Properties
The navigation graph.
Create a position corresponding to the origin of this environment.
A factory of shapes compatible with this environment.
Functions
Add a GlobalReaction to the Environment.
Add a Layer to the Environment.
Adds an obstacle to this environment.
Add a terminator indicating whether the simulation should be considered finished.
Add a terminator indicating whether the simulation should be considered finished.
Computes the farthest position reachable by a node towards a desiredPosition, avoiding node overlapping. If no node is located in between, desiredPosition is returned. Otherwise, the first position where the node collides with someone else is returned. For collision purposes, hitboxes are used: each node is given a circular hitbox of radius equal to its shape's radius (shapeless nodes can't cause overlapping). The client can specify a different radius for the hitbox of the moving node.
Gets the heading of a node as a direction vector.
Given a node, this method returns its neighborhood.
Allows to access a Node in this Environment known its id. Depending on the implementation, this method may or not be optimized (namely, id could run in constant or linear time with the number of nodes).
Gets all nodes whose shape.intersect is true for the given shape.
Given a node this method returns a list of all the surroundings nodes within the given range. Note that this method (depending on the implementation) might be not optimized, and it's consequently much better to use Environment.getNeighborhood and filter the neighborhood if you are sure that all the nodes within the range are connected to the center.
Given a point and a range, retrieves all the obstacles within.
Given a point and a range, retrieves all the obstacles within. This function is maintained for compatibility with the previous version of the API, and may be deprecated in the future.
Calculates the position of a node.
Gets the shape of a node relatively to its position and heading in the environment.
Given the coordinates of the point, returns a Position compatible with this environment.
Creates a new Euclidean2DPosition.
Creates an euclidean position from the given coordinates.
This method moves a node in the environment toward some direction. If node move is unsupported, it does nothing. Subclasses may override this method if they want to change the way a node moves towards some direction. The current implementation internally calls {@link #moveNodeToPosition(Node, Position2D)}, as such, overriding that method may suffice.
Moves the node to the farthestPositionReachable towards the desired newPosition. If the node is shapeless, it is simply moved to newPosition.
This method must calculate the ABSOLUTE next allowed position given the current position and the position in which the node wants to move. For example, if your node is in position 2,3, wants to move to 3,4 but the next allowed position (because, e.g., of physical obstacles) is 2.5,3.5, the result must be a Position containing coordinates 2.5,3.5.
This method must calculate the ABSOLUTE next allowed position given the current position and the position in which the node wants to move. For example, if your node is in position [2,3], wants to move to [3,4] but the next allowed position (because, e.g., of physical obstacles) is [2.5,3.5], the result must be a Position containing coordinates [2.5,3.5].
Returns a random element of the Iterable using the provided randomGenerator.
Remove a GlobalReaction from the Environment.
This method allows to remove a node. If node removal is unsupported, it does nothing.
Removes an obstacle from this environment.
Sets the heading of a node.
Returns the EnvironmentSubscriptionMonitor of this Environment.
A function that maps an Environment to its surrogate class (EnvironmentSurrogate). Use the toSuitablePositionSurrogate strategy for PositionSurrogate mapping.
A function that maps an Environment to its surrogate class (EnvironmentSurrogate).
Converts an Environment to a EnvironmentSurrogate.