ImageEnvironment

This environment loads an image from the file system, and marks as obstacles all the pixels of a given color.

Parameters

<T>

concentration type

Constructors

Link copied to clipboard
constructor(incarnation: Incarnation<T, Euclidean2DPosition>, path: String)
constructor(incarnation: Incarnation<T, Euclidean2DPosition>, path: String, zoom: Double)
constructor(incarnation: Incarnation<T, Euclidean2DPosition>, path: String, zoom: Double, dx: Double, dy: Double)
constructor(incarnation: Incarnation<T, Euclidean2DPosition>, obstacleColor: Int, path: String, zoom: Double, dx: Double, dy: Double)

Properties

Link copied to clipboard
Default color to be parsed as obstacle.
Link copied to clipboard
Default X starting position.
Link copied to clipboard
Default Y starting position.
Link copied to clipboard
val DEFAULT_ZOOM: Double = 1.0
Default zoom level.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val nodes: ListSet<Node<T>>
Link copied to clipboard

A factory of shapes compatible with this environment.

Link copied to clipboard
open var simulation: Simulation<T, P>

Functions

Link copied to clipboard
Link copied to clipboard
fun addLayer(p: Molecule, p1: Layer<T, P>)
Link copied to clipboard
fun addNode(p: Node<T>, p1: P): Boolean
Link copied to clipboard
abstract fun addObstacle(p: W)
Link copied to clipboard
Link copied to clipboard
abstract fun farthestPositionReachable(node: Node<T>, desiredPosition: P, hitboxRadius: Double): P

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.

open fun farthestPositionReachable(node: Node<T>, desiredPosition: Euclidean2DPosition, hitboxRadius: Double): Euclidean2DPosition

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.

Link copied to clipboard
fun forEach(p: Consumer<in Node<T>>)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract fun getHeading(node: Node<T>): P

Gets the heading of a node as a direction vector.

Link copied to clipboard
Link copied to clipboard
fun getLayers(): ListSet<Layer<T, P>>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun getNodeByID(p: Int): Node<T>
Link copied to clipboard
Link copied to clipboard

Gets all nodes whose shape.intersect is true for the given shape.

Link copied to clipboard
fun getNodesWithinRange(p: Node<T>, p1: Double): ListSet<Node<T>>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getOrigin(): P
Link copied to clipboard
fun getPosition(p: Node<T>): P
Link copied to clipboard
abstract fun getShape(node: Node<T>): Shape<P, A>

Gets the shape of a node relatively to its position and heading in the environment.

Link copied to clipboard
abstract fun getShapeFactory(): F

A factory of shapes compatible with this environment.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract fun hasMobileObstacles(): Boolean

Subclasses dealing with mobile obstacles may change this.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract fun iterator(): Iterator<T>
Link copied to clipboard
abstract fun makePosition(p: Array<Number>): P

open fun makePosition(coordinates: Array<Number>): Euclidean2DPosition

Creates an euclidean position from the given coordinates.

Link copied to clipboard
open fun moveNode(p: Node<T>, p1: P)
Link copied to clipboard
open fun moveNodeToPosition(p: Node<T>, p1: P)

open fun moveNodeToPosition(node: Node<T>, newPosition: Euclidean2DPosition)

Moves the node to the farthestPositionReachable towards the desired newPosition. If the node is shapeless, it is simply moved to newPosition.

open fun moveNodeToPosition(@Nonnull node: Node<T>, newPos: Euclidean2DPosition)
Moves the node to the farthestPositionReachable towards the desired newPosition.
Link copied to clipboard
abstract fun next(p: P, p1: P): P
@Nonnull
fun next(@Nonnull current: Euclidean2DPosition, @Nonnull desired: Euclidean2DPosition): Euclidean2DPosition

This method must calculate the ABSOLUTE next allowed position given the current position and the position in which the node wants to move.
Link copied to clipboard
Link copied to clipboard
fun removeNode(p: Node<T>)
Link copied to clipboard
Link copied to clipboard
open fun setHeading(node: Node<T>, direction: Euclidean2DPosition)

Sets the heading of a node.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun toString(): String