PhysicsEnvironment

An environment supporting physics and nodes shapes. Note: due to the high number of parameters it's highly recommended not to use this interface directly, but to create an apposite interface extending this one instead.

Parameters

factory of shapes compatible with this environment

Inheritors

Properties

Link copied to clipboard
abstract val dimensions: Int
Link copied to clipboard
abstract val globalReactions: ListSet<GlobalReaction<T>>
Link copied to clipboard
abstract val incarnation: Incarnation<T, P>
Link copied to clipboard
abstract val isTerminated: Boolean
Link copied to clipboard
abstract val layers: ListSet<Layer<T, P>>
Link copied to clipboard
abstract var linkingRule: LinkingRule<T, P>
Link copied to clipboard
abstract val nodeCount: Int
Link copied to clipboard
abstract val nodes: ListSet<Node<T>>
Link copied to clipboard
abstract val offset: DoubleArray
Link copied to clipboard
open val origin: P
Link copied to clipboard
abstract val shapeFactory: F

A factory of shapes compatible with this environment.

Link copied to clipboard
abstract var simulation: Simulation<T, P>
Link copied to clipboard
abstract val simulationOrNull: Simulation<T, P>?
Link copied to clipboard
abstract val size: DoubleArray
Link copied to clipboard

Functions

Link copied to clipboard
abstract fun addGlobalReaction(reaction: GlobalReaction<T>)
Link copied to clipboard
abstract fun addLayer(molecule: Molecule, layer: Layer<T, P>)
Link copied to clipboard
abstract fun addNode(node: Node<T>, position: P): Boolean
Link copied to clipboard
abstract fun addTerminator(terminator: TerminationPredicate<T, P>)
open fun addTerminator(terminator: (Environment<T, P>) -> Boolean)
Link copied to clipboard
abstract fun farthestPositionReachable(node: Node<T>, desiredPosition: P, hitboxRadius: Double = getShape(node).radius): 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.

Link copied to clipboard
abstract fun getDistanceBetweenNodes(n1: Node<T>, n2: Node<T>): Double
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
abstract fun getLayer(molecule: Molecule): Layer<T, P>?
Link copied to clipboard
abstract fun getNeighborhood(node: Node<T>): Neighborhood<T>
Link copied to clipboard
abstract fun getNodeByID(id: Int): Node<T>
Link copied to clipboard
abstract fun getNodesWithin(shape: Shape<P, A>): List<Node<T>>

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

Link copied to clipboard
abstract fun getNodesWithinRange(position: P, range: Double): ListSet<Node<T>>
abstract fun getNodesWithinRange(node: Node<T>, range: Double): ListSet<Node<T>>
Link copied to clipboard
abstract 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 operator fun iterator(): Iterator<Node<T>>
Link copied to clipboard
abstract fun makePosition(vararg coordinates: Number): P
open fun makePosition(coordinates: List<Number>): P
Link copied to clipboard
open fun moveNode(node: Node<T>, direction: P)
Link copied to clipboard
abstract fun moveNodeToPosition(node: Node<T>, position: P)
Link copied to clipboard
abstract fun removeGlobalReaction(reaction: GlobalReaction<T>)
Link copied to clipboard
abstract fun removeNode(node: Node<T>)
Link copied to clipboard
abstract fun setHeading(node: Node<T>, direction: P)

Sets the heading of a node.