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

A factory of shapes compatible with this environment.

Functions

Link copied to clipboard
Link copied to clipboard
abstract fun addLayer(p0: Molecule, p1: Layer<T, Euclidean2DPosition>)
Link copied to clipboard
abstract fun addNode(p0: Node<T>, p1: Euclidean2DPosition): Boolean
Link copied to clipboard
Link copied to clipboard
abstract fun farthestPositionReachable(node: Node<T>, desiredPosition: Euclidean2DPosition, hitboxRadius: Double = getShape(node).radius): 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
abstract fun getDimensions(): Int
Link copied to clipboard
abstract fun getDistanceBetweenNodes(p0: Node<T>, p1: Node<T>): Double
Link copied to clipboard
abstract fun getGlobalReactions(): ListSet<GlobalReaction<T>>
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
Link copied to clipboard
Link copied to clipboard
abstract fun getLayers(): ListSet<Layer<T, Euclidean2DPosition>>
Link copied to clipboard
Link copied to clipboard
abstract fun getNeighborhood(p0: Node<T>): Neighborhood<T>
Link copied to clipboard
abstract fun getNodeByID(p0: Int): Node<T>
Link copied to clipboard
abstract fun getNodeCount(): Int
Link copied to clipboard
abstract fun getNodes(): ListSet<Node<T>>
Link copied to clipboard

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

Link copied to clipboard
abstract fun getNodesWithinRange(p0: Node<T>, p1: Double): ListSet<Node<T>>
abstract fun getNodesWithinRange(p0: Euclidean2DPosition, p1: Double): ListSet<Node<T>>
Link copied to clipboard
abstract fun getOffset(): DoubleArray
Link copied to clipboard
@Nonnull
abstract fun getPosition(p0: Node<T>): Euclidean2DPosition
Link copied to clipboard

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

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

Get node's current linear velocity.

Link copied to clipboard
abstract fun isTerminated(): Boolean
Link copied to clipboard
abstract operator override fun iterator(): MutableIterator<Node<T>>
Link copied to clipboard
abstract fun makePosition(vararg p0: Number): Euclidean2DPosition
abstract fun makePosition(vararg coordinates: Double): Euclidean2DPosition
Link copied to clipboard
open fun moveNode(node: Node<T>, direction: Euclidean2DPosition)
Link copied to clipboard
@Nonnull
abstract fun moveNodeToPosition(@Nonnull p0: Node<T>, @Nonnull p1: Euclidean2DPosition)
Link copied to clipboard
Link copied to clipboard
abstract fun removeNode(p0: Node<T>)
Link copied to clipboard
abstract 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
abstract fun setVelocity(node: Node<T>, velocity: Euclidean2DPosition)

Set node's current linear velocity.

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

Compute any collision response and update node positions.