Class AligningSteeringAlgorithm

    • Field Detail

      • stopAngle

        protected final double stopAngle
        Angle to the target under which the agent could stop.
      • decelerationAngle

        protected final double decelerationAngle
        Angle to the target under which the agent could decelerate.
      • approximationFactor

        protected final int approximationFactor
        Approximation factor.
    • Constructor Detail

      • AligningSteeringAlgorithm

        public AligningSteeringAlgorithm​(double stopAngle,
                                         double decelerationAngle,
                                         int approximationFactor)
        Constructor.
        Parameters:
        stopAngle - the angle to the target under which the agent could stop.
        decelerationAngle - the angle 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 double calculate​(Vector2D<?,​?> orientation,
                                double angularSpeed,
                                double maxAngularAcceleration,
                                Vector2D<?,​?> target)
        Description copied from interface: AligningMotionAlgorithm
        Calculate the rotation for being aligned to the target vector.
        Specified by:
        calculate in interface AligningMotionAlgorithm
        Parameters:
        orientation - is the current orientation of the entity.
        angularSpeed - is the current angular speed of the entity.
        maxAngularAcceleration - is the maximal angular speed or acceleration of the entity.
        target - is the vector to match.
        Returns:
        the agent motion.