import Vector from '../../math/Vector';
import Location from '../../utils/Location';
import Limiter from '../Limiter';
import Steerable from '../Steerable';
import SteeringAcceleration from '../SteeringAcceleration';
import SteeringBehavior from '../SteeringBehavior';
/**
* {@code Arrive} behavior moves the agent towards a target position. It is similar to seek but it attempts to arrive at the target
* position with a zero velocity.
*
* {@code Arrive} behavior uses two radii. The {@code arrivalTolerance} lets the owner get near enough to the target without
* letting small errors keep it in motion. The {@code decelerationRadius}, usually much larger than the previous one, specifies
* when the incoming character will begin to slow down. The algorithm calculates an ideal speed for the owner. At the slowing-down
* radius, this is equal to its maximum linear speed. At the target point, it is zero (we want to have zero speed when we arrive).
* In between, the desired speed is an interpolated intermediate value, controlled by the distance from the target.
*
* The direction toward the target is calculated and combined with the desired speed to give a target velocity. The algorithm
* looks at the current velocity of the character and works out the acceleration needed to turn it into the target velocity. We
* can't immediately change velocity, however, so the acceleration is calculated based on reaching the target velocity in a fixed
* time scale known as {@code timeToTarget}. This is usually a small value; it defaults to 0.1 seconds which is a good starting
* point.
*
* @param Type of vector, either 2D or 3D, implementing the {@link Vector} interface
*
* @author davebaol
*/
declare class Arrive> extends SteeringBehavior {
/** The target to arrive to. */
protected target: Location;
/**
* The tolerance for arriving at the target. It lets the owner get near enough to the target without letting small errors keep
* it in motion.
*/
protected arrivalTolerance: number;
/** The radius for beginning to slow down */
protected decelerationRadius: number;
/** The time over which to achieve target speed */
protected timeToTarget: number;
/**
* Creates an {@code Arrive} behavior for the specified owner and target.
* @param owner the owner of this behavior
* @param target the target of this behavior
*/
constructor(owner: Steerable, target?: Location);
/** Returns the target to arrive to. */
getTarget(): Location;
/**
* Sets the target to arrive to.
* @return this behavior for chaining.
*/
setTarget(target: Location): Arrive;
/**
* Returns the tolerance for arriving at the target. It lets the owner get near enough to the target without letting small
* errors keep it in motion.
*/
getArrivalTolerance(): number;
/**
* Sets the tolerance for arriving at the target. It lets the owner get near enough to the target without letting small errors
* keep it in motion.
* @return this behavior for chaining.
*/
setArrivalTolerance(arrivalTolerance: number): Arrive;
/** Returns the radius for beginning to slow down. */
getDecelerationRadius(): number;
/**
* Sets the radius for beginning to slow down.
* @return this behavior for chaining.
*/
setDecelerationRadius(decelerationRadius: number): Arrive;
/** Returns the time over which to achieve target speed. */
getTimeToTarget(): number;
/**
* Sets the time over which to achieve target speed.
* @return this behavior for chaining.
*/
setTimeToTarget(timeToTarget: number): Arrive;
setOwner(owner: Steerable): Arrive;
setEnabled(enabled: boolean): Arrive;
/**
* Sets the limiter of this steering behavior. The given limiter must at least take care of the maximum linear speed and
* acceleration.
* @return this behavior for chaining.
*/
setLimiter(limiter: Limiter): Arrive;
protected calculateRealSteering(steering: SteeringAcceleration): SteeringAcceleration;
protected arrive(steering: SteeringAcceleration, targetPosition: T): SteeringAcceleration;
}
export default Arrive;