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
open fun addGlobalReaction(reaction: GlobalReaction<T>)
Link copied to clipboard
fun addLayer(m: Molecule, l: Layer<T, P>)
Link copied to clipboard
fun addNode(node: Node<T>, p: P): Boolean
Link copied to clipboard
abstract fun addObstacle(p: W)
Link copied to clipboard
fun addTerminator(terminator: Predicate<Environment<T, P>>)
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(action: 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(id: 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(center: Node<T>, range: 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(node: 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(node: Node<T>, direction: P)
Link copied to clipboard
open fun moveNodeToPosition(node: Node<T>, newpos: 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(node: 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