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 FacingMotionAlgorithmfacingFacing algorithm to delegate to.protected doublemaxWheelRotationMaximal rotation of the virtual wheel.protected SeekingMotionAlgorithmseekingSeeking algorithm to delegate to.protected doublewheelDistanceDistance between the agent position and the center of the virtual wheel.protected doublewheelRadiusRadius 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 AgentMotioncalculate(Point2D<?,?> position, Vector2D<?,?> orientation, double linearSpeed, double maxLinear, double angularSpeed, double maxAngular)Calculate the random motion.RandomAlgorithmclone()Clone this algorithm.booleanequals(Object obj)inthashCode()
-
-
-
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:RandomMotionAlgorithmClone this algorithm.- Specified by:
clonein interfaceRandomMotionAlgorithm- Overrides:
clonein classObject- Returns:
- the clone.
-
calculate
public AgentMotion calculate(Point2D<?,?> position, Vector2D<?,?> orientation, double linearSpeed, double maxLinear, double angularSpeed, double maxAngular)
Description copied from interface:RandomMotionAlgorithmCalculate the random motion.- Specified by:
calculatein 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.
-
-