Package icyllis.modernui.view

# Class VelocityTracker.Estimator

java.lang.Object
icyllis.modernui.view.VelocityTracker.Estimator

Enclosing class:
  `VelocityTracker`

@Internal public static final class VelocityTracker.Estimator extends Object
An estimator for the movements of a pointer based on a polynomial model.

The last recorded position of the pointer is at time zero seconds. Past estimated positions are at negative times and future estimated positions are at positive times.

First coefficient is position (in pixels), second is velocity (in pixels per second), third is acceleration (in pixels per second squared).

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `float`
  `confidence`
  Confidence (coefficient of determination), between 0 (no fit) and 1 (perfect fit).
  `int`
  `degree`
  Polynomial degree, or zero if only position information is available.
  `long`
  `time`
  Estimator time base, in nanoseconds.
  `final float[]`
  `xCoeff`
  Polynomial coefficients describing motion in X.
  `final float[]`
  `yCoeff`
  Polynomial coefficients describing motion in Y.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Estimator()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  `float`
  `estimateX(float time)`
  Gets an estimate of the X position of the pointer at the specified time point.
  `float`
  `estimateY(float time)`
  Gets an estimate of the Y position of the pointer at the specified time point.
  `float`
  `getXCoeff(int index)`
  Gets the X coefficient with the specified index.
  `float`
  `getYCoeff(int index)`
  Gets the Y coefficient with the specified index.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### time

    public long time
    Estimator time base, in nanoseconds.

  - ### xCoeff

    public final float[] xCoeff
    Polynomial coefficients describing motion in X.

  - ### yCoeff

    public final float[] yCoeff
    Polynomial coefficients describing motion in Y.

  - ### degree

    public int degree
    Polynomial degree, or zero if only position information is available.

  - ### confidence

    public float confidence
    Confidence (coefficient of determination), between 0 (no fit) and 1 (perfect fit).

- ## Constructor Details

  - ### Estimator

    public Estimator()

- ## Method Details

  - ### estimateX

    public float estimateX(float time)
    Gets an estimate of the X position of the pointer at the specified time point.
    Parameters:
      `time` - The time point in seconds, 0 is the last recorded time.
    Returns:
      The estimated X coordinate.

  - ### estimateY

    public float estimateY(float time)
    Gets an estimate of the Y position of the pointer at the specified time point.
    Parameters:
      `time` - The time point in seconds, 0 is the last recorded time.
    Returns:
      The estimated Y coordinate.

  - ### getXCoeff

    public float getXCoeff(int index)
    Gets the X coefficient with the specified index.
    Parameters:
      `index` - The index of the coefficient to return.
    Returns:
      The X coefficient, or 0 if the index is greater than the degree.

  - ### getYCoeff

    public float getYCoeff(int index)
    Gets the Y coefficient with the specified index.
    Parameters:
      `index` - The index of the coefficient to return.
    Returns:
      The Y coefficient, or 0 if the index is greater than the degree.

  - ### clear

    public void clear()