Class RandomAlgorithm
- java.lang.Object
-
- org.arakhne.afc.agentmotion.common.RandomAlgorithm
-
- All Implemented Interfaces:
Serializable
,Cloneable
,RandomMotionAlgorithm
public class RandomAlgorithm extends Object implements RandomMotionAlgorithm, Serializable, Cloneable
Agent is changing randomly its position and orientation.This algorithm uses speeds or accelerations, depending on its delegates.
- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:51
- Author:
- Stéphane GALLAND
- See Also:
- Serialized Form
- Maven Group Id:
- org.arakhne.afc.advanced
- Maven Artifact Id:
- agentmotion
-
-
Field Summary
Fields Modifier and Type Field Description protected FacingMotionAlgorithm
facing
Facing algorithm to delegate to.protected double
maxWheelRotation
Maximal rotation of the virtual wheel.protected SeekingMotionAlgorithm
seeking
Seeking algorithm to delegate to.protected double
wheelDistance
Distance between the agent position and the center of the virtual wheel.protected double
wheelRadius
Radius of the virtual wheel.
-
Constructor Summary
Constructors Constructor Description RandomAlgorithm(double wheelDistance, double wheelRadius, double maxWheelRotation, FacingMotionAlgorithm facing, SeekingMotionAlgorithm seeking)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AgentMotion
calculate(Point2D<?,?> position, Vector2D<?,?> orientation, double linearSpeed, double maxLinear, double angularSpeed, double maxAngular)
Calculate the random motion.RandomAlgorithm
clone()
Clone this algorithm.boolean
equals(Object obj)
int
hashCode()
-
-
-
Field Detail
-
wheelDistance
protected final double wheelDistance
Distance between the agent position and the center of the virtual wheel.
-
wheelRadius
protected final double wheelRadius
Radius of the virtual wheel.
-
maxWheelRotation
protected final double maxWheelRotation
Maximal rotation of the virtual wheel.
-
facing
protected final FacingMotionAlgorithm facing
Facing algorithm to delegate to.
-
seeking
protected final SeekingMotionAlgorithm seeking
Seeking algorithm to delegate to.
-
-
Constructor Detail
-
RandomAlgorithm
public RandomAlgorithm(double wheelDistance, double wheelRadius, double maxWheelRotation, FacingMotionAlgorithm facing, SeekingMotionAlgorithm seeking)
Constructor.- Parameters:
wheelDistance
- the distance between the agent position and the center of the virtual wheel.wheelRadius
- the radius of the virtual wheel.maxWheelRotation
- the maximal rotation of the virtual wheel.facing
- the facing algorithm to delegate to.seeking
- the seeking algorithm to delegate to.
-
-
Method Detail
-
clone
@Pure public RandomAlgorithm clone()
Description copied from interface:RandomMotionAlgorithm
Clone this algorithm.- Specified by:
clone
in interfaceRandomMotionAlgorithm
- Overrides:
clone
in classObject
- Returns:
- the clone.
-
calculate
public AgentMotion calculate(Point2D<?,?> position, Vector2D<?,?> orientation, double linearSpeed, double maxLinear, double angularSpeed, double maxAngular)
Description copied from interface:RandomMotionAlgorithm
Calculate the random motion.- Specified by:
calculate
in interfaceRandomMotionAlgorithm
- Parameters:
position
- is the current position of the entity.orientation
- is the current orientation of the entity.linearSpeed
- is the current linear speed of the entity.maxLinear
- is the maximal linear speed or acceleration of the entity.angularSpeed
- is the current angular speed of the entity.maxAngular
- is the maximal angular speed or acceleration of the entity.- Returns:
- the agent motion.
-
-