Class Continuous2DObstacles
-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.Environment
,it.unibo.alchemist.model.EnvironmentWithObstacles
,it.unibo.alchemist.model.EuclideanEnvironment
,it.unibo.alchemist.model.environments.Environment2DWithObstacles
,it.unibo.alchemist.model.environments.Euclidean2DEnvironment
,it.unibo.alchemist.model.environments.Euclidean2DEnvironmentWithObstacles
,it.unibo.alchemist.model.physics.PhysicsEnvironment
,it.unibo.alchemist.model.physics.environments.EuclideanPhysics2DEnvironmentWithObstacles
,it.unibo.alchemist.model.physics.environments.Physics2DEnvironment
,java.io.Serializable
,java.lang.Iterable
public class Continuous2DObstacles<T> extends LimitedContinuos2D<T> implements EuclideanPhysics2DEnvironmentWithObstacles<W, T>
-
-
Field Summary
Fields Modifier and Type Field Description public final Euclidean2DShapeFactory
shapeFactory
public final ListSet<GlobalReaction<T>>
globalReactions
public final ListSet<Node<T>>
nodes
public transient Incarnation<T, P>
incarnation
public transient Simulation<T, P>
simulation
-
Constructor Summary
Constructors Constructor Description Continuous2DObstacles(Incarnation<T, Euclidean2DPosition> incarnation)
-
Method Summary
Modifier and Type Method Description final void
addObstacle(@Nonnull() RectObstacle2D<Euclidean2DPosition> o)
final List<RectObstacle2D<Euclidean2DPosition>>
getObstacles()
final List<RectObstacle2D<Euclidean2DPosition>>
getObstaclesInRange(@Nonnull() Euclidean2DPosition center, double range)
final List<RectObstacle2D<Euclidean2DPosition>>
getObstaclesInRange(double centerx, double centery, double range)
boolean
hasMobileObstacles()
Subclasses dealing with mobile obstacles may change this. final boolean
intersectsObstacle(Euclidean2DPosition start, Euclidean2DPosition end)
final Euclidean2DPosition
next(@Nonnull() Euclidean2DPosition current, @Nonnull() Euclidean2DPosition desired)
final Euclidean2DPosition
next(double ox, double oy, double nx, double ny)
This method must calculate the ABSOLUTE next allowed position given the current position and the position in which the node wants to move. final boolean
removeObstacle(@Nonnull() RectObstacle2D<Euclidean2DPosition> o)
-
Methods inherited from class it.unibo.alchemist.model.physics.environments.ContinuousPhysics2DEnvironment
farthestPositionReachable, getHeading, getNodesWithin, getShape, getShapeFactory, makePosition, moveNodeToPosition, setHeading
-
Methods inherited from class it.unibo.alchemist.model.environments.AbstractEnvironment
addGlobalReaction, addLayer, addNode, addTerminator, forEach, getDistanceBetweenNodes, getGlobalReactions, getIncarnation, getLayer, getLayers, getLinkingRule, getNeighborhood, getNodeByID, getNodeCount, getNodes, getNodesWithinRange, getPosition, getSimulation, getSizeInDistanceUnits, isTerminated, iterator, removeGlobalReaction, removeNode, setLinkingRule, setSimulation, spliterator, toString
-
Methods inherited from class it.unibo.alchemist.model.physics.environments.LimitedContinuos2D
moveNodeToPosition
-
Methods inherited from class it.unibo.alchemist.model.environments.Abstract2DEnvironment
getDimensions, getOffset, getSize, moveNodeToPosition
-
Methods inherited from class it.unibo.alchemist.model.environments.Euclidean2DEnvironment
getOrigin, makePosition
-
Methods inherited from class it.unibo.alchemist.model.Environment
makePosition
-
Methods inherited from class java.lang.Iterable
iterator, spliterator
-
Methods inherited from class it.unibo.alchemist.model.EuclideanEnvironment
getOrigin, moveNode
-
Methods inherited from class it.unibo.alchemist.model.physics.PhysicsEnvironment
farthestPositionReachable, getHeading, getShape, getShapeFactory
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
Continuous2DObstacles
Continuous2DObstacles(Incarnation<T, Euclidean2DPosition> incarnation)
- Parameters:
incarnation
- the current incarnation.
-
-
Method Detail
-
addObstacle
final void addObstacle(@Nonnull() RectObstacle2D<Euclidean2DPosition> o)
-
getObstacles
@Nonnull() final List<RectObstacle2D<Euclidean2DPosition>> getObstacles()
-
getObstaclesInRange
@Nonnull() final List<RectObstacle2D<Euclidean2DPosition>> getObstaclesInRange(@Nonnull() Euclidean2DPosition center, double range)
-
getObstaclesInRange
@Nonnull() final List<RectObstacle2D<Euclidean2DPosition>> getObstaclesInRange(double centerx, double centery, double range)
-
hasMobileObstacles
boolean hasMobileObstacles()
Subclasses dealing with mobile obstacles may change this.
- Returns:
false
-
intersectsObstacle
final boolean intersectsObstacle(Euclidean2DPosition start, Euclidean2DPosition end)
-
next
@Nonnull() final Euclidean2DPosition next(@Nonnull() Euclidean2DPosition current, @Nonnull() Euclidean2DPosition desired)
-
next
final Euclidean2DPosition next(double ox, double oy, double nx, double ny)
This method must calculate the ABSOLUTE next allowed position given the current position and the position in which the node wants to move. For example, if your node is in position [2,3], wants to move to [3,4] but the next allowed position (because, e.g., of physical obstacles) is [2.5,3.5], the result must be a Position containing coordinates [2.5,3.5].
- Parameters:
ox
- The current X positionoy
- The current Y positionnx
- The requested X positionny
- The requested Y position- Returns:
the next allowed position, where the node can actually move. This position MUST be considered as a vector whose start point is in [ox, oy].
-
removeObstacle
final boolean removeObstacle(@Nonnull() RectObstacle2D<Euclidean2DPosition> o)
-
-
-
-