Class InterpolatingMatrixTreeMap<K extends Number,​R extends Num,​C extends Num>

java.lang.Object
edu.wpi.first.math.InterpolatingMatrixTreeMap<K,​R,​C>
Type Parameters:
K - Key type.
R - Number of matrix rows.
C - Number of matrix columns.

public class InterpolatingMatrixTreeMap<K extends Number,​R extends Num,​C extends Num>
extends Object
Interpolating Tree Maps are used to get values at points that are not defined by making a guess from points that are defined. This uses linear interpolation.
  • Constructor Details

  • Method Details

    • put

      public void put​(K key, Matrix<R,​C> value)
      Inserts a key-value pair.
      Parameters:
      key - The key.
      value - The value.
    • get

      public Matrix<R,​C> get​(K key)
      Returns the value associated with a given key.

      If there's no matching key, the value returned will be a linear interpolation between the keys before and after the provided one.

      Parameters:
      key - The key.
      Returns:
      The value associated with the given key.
    • interpolate

      public Matrix<R,​C> interpolate​(Matrix<R,​C> val1, Matrix<R,​C> val2, double d)
      Return the value interpolated between val1 and val2 by the interpolant d.
      Parameters:
      val1 - The lower part of the interpolation range.
      val2 - The upper part of the interpolation range.
      d - The interpolant in the range [0, 1].
      Returns:
      The interpolated value.
    • inverseInterpolate

      public double inverseInterpolate​(K up, K q, K down)
      Return where within interpolation range [0, 1] q is between down and up.
      Parameters:
      up - Upper part of interpolation range.
      q - Query.
      down - Lower part of interpolation range.
      Returns:
      Interpolant in range [0, 1].