Package edu.wpi.first.math
Class InterpolatingMatrixTreeMap<K extends Number,R extends Num,C extends Num>
java.lang.Object
edu.wpi.first.math.InterpolatingMatrixTreeMap<K,R,C>
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 Summary
Constructors Constructor Description InterpolatingMatrixTreeMap()
-
Method Summary
Modifier and Type Method Description Matrix<R,C>
get(K key)
Returns the value associated with a given key.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.double
inverseInterpolate(K up, K q, K down)
Return where within interpolation range [0, 1] q is between down and up.void
put(K key, Matrix<R,C> value)
Inserts a key-value pair.
-
Constructor Details
-
Method Details
-
put
Inserts a key-value pair.- Parameters:
key
- The key.value
- The value.
-
get
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
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
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].
-