LimitedContinuos2D

This class represents a 2D continuous environment with spatial limitations. Those limitations will prevent nodes to move in positions which are not allowed.

Parameters

<T>

concentration type

Inheritors

Constructors

Link copied to clipboard
constructor(incarnation: Incarnation<T, Euclidean2DPosition>)

Properties

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
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
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
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(@Nonnull node: Node<T>, newPos: Euclidean2DPosition)
Moves the node to the farthestPositionReachable towards the desired newPosition.
Link copied to clipboard
fun <R> Iterable<R>.randomElement(randomGenerator: RandomGenerator): R

Returns a random element of the Iterable using the provided randomGenerator.

Link copied to clipboard
Link copied to clipboard
fun removeNode(p: Node<T>)
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
fun <R> Iterable<R>.shuffled(randomGenerator: RandomGenerator): Iterable<R>

Fisher–Yates shuffle algorithm using a RandomGenerator. More information on Wikipedia.

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