Class ArrivingSteeringAlgorithm

    • Field Detail

      • stopDistance

        protected final double stopDistance
        Square distance to the target under which the agent could stop.
      • decelerationDistance

        protected final double decelerationDistance
        Square distance to the target under which the agent could decelerate.
      • approximationFactor

        protected final int approximationFactor
        Approximation factor.
    • Constructor Detail

      • ArrivingSteeringAlgorithm

        public ArrivingSteeringAlgorithm​(double stopDistance,
                                         double decelerationDistance,
                                         int approximationFactor)
        Constructor.
        Parameters:
        stopDistance - the distance to the target under which the agent could stop.
        decelerationDistance - the distance the target under which the agent could decelerate.
        approximationFactor - the factor used for approximate the deceleration. It must be greater than 1.
    • Method Detail

      • calculate

        public Vector2D<?,​?> calculate​(Point2D<?,​?> position,
                                             double linearSpeed,
                                             double maxLinear,
                                             Point2D<?,​?> target)
        Description copied from interface: ArrivingMotionAlgorithm
        Calculate the linear motion for arriving the target point.
        Specified by:
        calculate in interface ArrivingMotionAlgorithm
        Parameters:
        position - is the current position of the entity.
        linearSpeed - is the current linear speed of the entity.
        maxLinear - is the maximal linear speed or acceleration of the entity.
        target - is the point to reach.
        Returns:
        the agent motion.