Package icyllis.modernui.view
Class VelocityTracker.Estimator
java.lang.Object
icyllis.modernui.view.VelocityTracker.Estimator
- Enclosing class:
VelocityTracker
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
Modifier and TypeFieldDescriptionfloat
Confidence (coefficient of determination), between 0 (no fit) and 1 (perfect fit).int
Polynomial degree, or zero if only position information is available.long
Estimator time base, in nanoseconds.final float[]
Polynomial coefficients describing motion in X.final float[]
Polynomial coefficients describing motion in Y. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.
-
Field Details
-
time
public long timeEstimator time base, in nanoseconds. -
xCoeff
public final float[] xCoeffPolynomial coefficients describing motion in X. -
yCoeff
public final float[] yCoeffPolynomial coefficients describing motion in Y. -
degree
public int degreePolynomial degree, or zero if only position information is available. -
confidence
public float confidenceConfidence (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()
-