Dynamics2DEnvironment

Any implementing Environment should take care of physical dynamics, in particular collision detection and response. This interface provides some hooks in order to be able to manage some of the node's physical state.

Properties

Link copied to clipboard
Link copied to clipboard
abstract val dimensions: Int
Link copied to clipboard
Link copied to clipboard
abstract val isTerminated: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract var networkModel: NetworkModel<T>
Link copied to clipboard
abstract val nodeCount: Observable<Int>
Link copied to clipboard
abstract val nodes: ObservableList<Node<T>>
Link copied to clipboard
abstract val offset: DoubleArray
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A factory of shapes compatible with this environment.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract val size: DoubleArray
Link copied to clipboard

Functions

Link copied to clipboard
abstract fun addLayer(molecule: Molecule, layer: Layer<T, Euclidean2DPosition>)
Link copied to clipboard
abstract fun addNode(node: Node<T>, position: Euclidean2DPosition): Boolean
Link copied to clipboard
abstract fun addReaction(reaction: Reaction<T>)
Link copied to clipboard
Link copied to clipboard
open operator fun contains(node: Node<T>): Boolean
Link copied to clipboard
Link copied to clipboard
abstract fun distanceBetween(n1: Node<T>, n2: Node<T>): Double
Link copied to clipboard
open fun Node<T>.distanceTo(other: Node<T>): Double
Link copied to clipboard
abstract fun getHeading(node: Node<T>): Euclidean2DPosition

Gets the heading of a node as a direction vector.

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard
abstract fun getVelocity(node: Node<T>): Euclidean2DPosition

Get node's current linear velocity.

Link copied to clipboard
abstract fun layerFor(molecule: Molecule): Layer<T, Euclidean2DPosition>?
Link copied to clipboard
Link copied to clipboard
open fun Node<T>.moveBy(displacement: Euclidean2DPosition)
Link copied to clipboard
open fun moveNodeBy(node: Node<T>, displacement: Euclidean2DPosition)
Link copied to clipboard
abstract fun moveNodeTo(node: Node<T>, position: Euclidean2DPosition)
Link copied to clipboard
open fun Node<T>.moveTo(position: Euclidean2DPosition)
Link copied to clipboard
abstract fun neighborhoodOf(node: Node<T>): Observable<Neighborhood<T>>
Link copied to clipboard
abstract fun nodesAround(position: Euclidean2DPosition, range: Double): List<Node<T>>
abstract fun nodesAround(node: Node<T>, range: Double): List<Node<T>>
Link copied to clipboard
open fun Node<T>.nodesInRange(range: Double): List<Node<T>>
Link copied to clipboard
abstract fun nodeWithId(id: Int): Node<T>
Link copied to clipboard
abstract fun observeLayerValue(molecule: Molecule, node: Node<T>): Observable<T?>
Link copied to clipboard
abstract fun observeNodesAround(node: Node<T>, range: Double): ObservableSet<Node<T>>
Link copied to clipboard
Link copied to clipboard
open fun Node<T>.remove()
open fun Reaction<T>.remove()
Link copied to clipboard
abstract fun removeNode(node: Node<T>)
Link copied to clipboard
abstract fun removeReaction(reaction: Reaction<T>)
Link copied to clipboard
abstract fun setHeading(node: Node<T>, direction: Euclidean2DPosition)

Sets the heading of a node.

Link copied to clipboard
abstract fun setVelocity(node: Node<T>, velocity: Euclidean2DPosition)

Set node's current linear velocity.

Link copied to clipboard
Link copied to clipboard
abstract fun updatePhysics(elapsedTime: Double)

Compute any collision response and update node positions.