-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.interfaces.Environment,it.unibo.alchemist.model.interfaces.EuclideanEnvironment,java.io.Serializable,kotlin.collections.Iterable,kotlin.collections.MutableIterable
public interface PhysicsEnvironment<T extends Object, P extends Position<P>, Vector<P>, A extends GeometricTransformation<P>, F extends GeometricShapeFactory<P, A>> implements EuclideanEnvironment<T, P>
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.
-
-
Method Summary
Modifier and Type Method Description abstract PgetHeading(Node<T> node)Gets the heading of a node as a direction vector. abstract UnitsetHeading(Node<T> node, P direction)Sets the heading of a node. abstract GeometricShape<P, A>getShape(Node<T> node)Gets the shape of a node relatively to its position and heading in the environment. abstract List<Node<T>>getNodesWithin(GeometricShape<P, A> shape)Gets all nodes whose shape.intersect is true for the given shape. abstract PfarthestPositionReachable(NodeWithShape<T, ?, ?> node, P desiredPosition, Double hitboxRadius)Computes the farthest position reachable by a node towards a desiredPosition, avoiding node overlapping. abstract FgetShapeFactory()A factory of shapes compatible with this environment. PgetOrigin()-
Methods inherited from class it.unibo.alchemist.model.interfaces.EuclideanEnvironment
addLayer, addNode, addTerminator, getDimensions, getDistanceBetweenNodes, getIncarnation, getLayer, getLayers, getLinkingRule, getNeighborhood, getNodeByID, getNodeCount, getNodes, getNodesWithinRange, getNodesWithinRange, getOffset, getPosition, getSimulation, getSize, getSizeInDistanceUnits, isTerminated, makePosition, moveNodeToPosition, removeNode, setLinkingRule, setSimulation -
Methods inherited from class kotlin.collections.MutableIterable
forEach, spliterator -
Methods inherited from class it.unibo.alchemist.model.interfaces.Environment
iterator -
Methods inherited from class it.unibo.alchemist.model.interfaces.environments.PhysicsEnvironment
makePosition, moveNode -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getHeading
abstract P getHeading(Node<T> node)
Gets the heading of a node as a direction vector.
- Parameters:
node- The node
-
setHeading
abstract Unit setHeading(Node<T> node, P direction)
Sets the heading of a node.
- Parameters:
node- The nodedirection- The direction vector.
-
getShape
abstract GeometricShape<P, A> getShape(Node<T> node)
Gets the shape of a node relatively to its position and heading in the environment.
- Parameters:
node- The node
-
getNodesWithin
abstract List<Node<T>> getNodesWithin(GeometricShape<P, A> shape)
Gets all nodes whose shape.intersect is true for the given shape.
- Parameters:
shape- the shape
-
farthestPositionReachable
abstract P farthestPositionReachable(NodeWithShape<T, ?, ?> node, P desiredPosition, Double hitboxRadius)
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.
-
getShapeFactory
abstract F getShapeFactory()
A factory of shapes compatible with this environment.
-
-
-
-