Interface PhysicsEnvironment
-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.Environment
,it.unibo.alchemist.model.EuclideanEnvironment
,java.io.Serializable
,kotlin.collections.Iterable
,kotlin.collections.MutableIterable
public interface PhysicsEnvironment<T extends Object, P extends Position<P>, Vector<P>, A extends Transformation<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 P
getHeading(Node<T> node)
Gets the heading of a node as a direction vector. abstract Unit
setHeading(Node<T> node, P direction)
Sets the heading of a node. abstract Shape<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(Shape<P, A> shape)
Gets all nodes whose shape.intersect is true for the given shape. abstract P
farthestPositionReachable(Node<T> node, P desiredPosition, Double hitboxRadius)
Computes the farthest position reachable by a node towards a desiredPosition, avoiding node overlapping. abstract F
getShapeFactory()
A factory of shapes compatible with this environment. -
Methods inherited from class it.unibo.alchemist.model.Environment
addGlobalReaction, addLayer, addNode, addTerminator, getDimensions, getDistanceBetweenNodes, getGlobalReactions, getIncarnation, getLayer, getLayers, getLinkingRule, getNeighborhood, getNodeByID, getNodeCount, getNodes, getNodesWithinRange, getNodesWithinRange, getOffset, getPosition, getSimulation, getSize, getSizeInDistanceUnits, isTerminated, makePosition, moveNodeToPosition, removeGlobalReaction, removeNode, setLinkingRule, setSimulation
-
Methods inherited from class kotlin.collections.Iterable
forEach, spliterator
-
Methods inherited from class kotlin.collections.MutableIterable
iterator
-
Methods inherited from class it.unibo.alchemist.model.EuclideanEnvironment
getOrigin, 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- Returns:
The heading of the given 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 Shape<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- Returns:
Its shape
-
getNodesWithin
abstract List<Node<T>> getNodesWithin(Shape<P, A> shape)
Gets all nodes whose shape.intersect is true for the given shape.
- Parameters:
shape
- the shape- Returns:
the set of nodes colliding with the given shape
-
farthestPositionReachable
abstract P farthestPositionReachable(Node<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.
-
-
-
-