import Vector from '../../math/Vector';
import Location from '../../utils/Location';
import Steerable from '../Steerable';
import SteeringAcceleration from '../SteeringAcceleration';
import Limiter from '../Limiter';
import Arrive from './Arrive';
import Path, { PathParam } from '../utils/Path';
/**
* {@code FollowPath} behavior produces a linear acceleration that moves the agent along the given path. First it calculates the
* agent location based on the specified prediction time. Then it works out the position of the internal target based on the
* location just calculated and the shape of the path. It finally uses {@link Seek seek} behavior to move the owner towards the
* internal target position. However, if the path is open {@link Arrive arrive} behavior is used to approach path's extremities
* when they are far less than the {@link FollowPath#decelerationRadius deceleration radius} from the internal target position.
*
* For complex paths with sudden changes of direction the predictive behavior (i.e., with prediction time greater than 0) can
* appear smoother than the non-predictive one (i.e., with no prediction time). However, predictive path following has the
* downside of cutting corners when some sections of the path come close together. This cutting-corner attitude can make the
* character miss a whole section of the path. This might not be what you want if, for example, the path represents a patrol
* route.
*
* @param Type of vector, either 2D or 3D, implementing the {@link Vector} interface
* @param Type of path parameter implementing the {@link PathParam} interface
*
* @author davebaol
*/
declare class FollowPath, P extends PathParam> extends Arrive {
/** The path to follow */
protected path: Path;
/** The distance along the path to generate the target. Can be negative if the owner has to move along the reverse direction. */
protected pathOffset: number;
/** The current position on the path */
protected pathParam: P;
/** The flag indicating whether to use {@link Arrive} behavior to approach the end of an open path. It defaults to {@code true}. */
protected arriveEnabled: boolean;
/** The time in the future to predict the owner's position. Set it to 0 for non-predictive path following. */
protected predictionTime: number;
private internalTargetPosition;
/**
* Creates a {@code FollowPath} behavior for the specified owner, path, path offset, maximum linear acceleration and prediction
* time.
* @param owner the owner of this behavior
* @param path the path to be followed by the owner
* @param pathOffset the distance along the path to generate the target. Can be negative if the owner is to move along the
* reverse direction.
* @param predictionTime the time in the future to predict the owner's position. Can be 0 for non-predictive path following.
*/
constructor(owner: Steerable, path: Path, pathOffset?: number, predictionTime?: number);
/** Returns the path to follow */
getPath(): Path;
/**
* Sets the path followed by this behavior.
* @param path the path to set
* @return this behavior for chaining.
*/
setPath(path: Path): FollowPath;
/** Returns the path offset. */
getPathOffset(): number;
/** Returns the flag indicating whether to use {@link Arrive} behavior to approach the end of an open path. */
isArriveEnabled(): boolean;
/** Returns the prediction time. */
getPredictionTime(): number;
/**
* Sets the prediction time. Set it to 0 for non-predictive path following.
* @param predictionTime the predictionTime to set
* @return this behavior for chaining.
*/
setPredictionTime(predictionTime: number): FollowPath;
/**
* Sets the flag indicating whether to use {@link Arrive} behavior to approach the end of an open path. It defaults to
* {@code true}.
* @param arriveEnabled the flag value to set
* @return this behavior for chaining.
*/
setArriveEnabled(arriveEnabled: boolean): FollowPath;
/**
* Sets the path offset to generate the target. Can be negative if the owner has to move along the reverse direction.
* @param pathOffset the pathOffset to set
* @return this behavior for chaining.
*/
setPathOffset(pathOffset: number): FollowPath;
/** Returns the current path parameter. */
getPathParam(): P;
/** Returns the current position of the internal target. This method is useful for debug purpose. */
getInternalTargetPosition(): T;
setOwner(owner: Steerable): FollowPath;
setEnabled(enabled: boolean): FollowPath;
/**
* Sets the limiter of this steering behavior. The given limiter must at least take care of the maximum linear speed and
* acceleration. However the maximum linear speed is not required for a closed path.
* @return this behavior for chaining.
*/
setLimiter(limiter: Limiter): FollowPath;
setTarget(target: Location): FollowPath;
setArrivalTolerance(arrivalTolerance: number): FollowPath;
setDecelerationRadius(decelerationRadius: number): FollowPath;
setTimeToTarget(timeToTarget: number): FollowPath;
protected calculateRealSteering(steering: SteeringAcceleration): SteeringAcceleration;
}
export default FollowPath;