001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package edu.wpi.first.math.interpolation;
006
007/**
008 * An object should extend interpolatable if you wish to interpolate between a lower and upper
009 * bound, such as a robot position on the field between timesteps. This behavior can be linear or
010 * nonlinear.
011 *
012 * @param <T> The class that is interpolatable.
013 */
014@SuppressWarnings("PMD.ImplicitFunctionalInterface")
015public interface Interpolatable<T> {
016  /**
017   * Return the interpolated value. This object is assumed to be the starting position, or lower
018   * bound.
019   *
020   * @param endValue The upper bound, or end.
021   * @param t How far between the lower and upper bound we are. This should be bounded in [0, 1].
022   * @return The interpolated value.
023   */
024  T interpolate(T endValue, double t);
025}