Improve gesture input scoring method 3.

Change-Id: I3142cb5ec922e661f0d7c1e1706de6015360b2ff
main
Keisuke Kuroyanagi 2012-10-11 20:24:41 +09:00
parent b0aa9606ae
commit 1e06a4d8e9
2 changed files with 14 additions and 2 deletions

View File

@ -108,6 +108,7 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi
mSearchKeysVector.clear(); mSearchKeysVector.clear();
mRelativeSpeeds.clear(); mRelativeSpeeds.clear();
mCharProbabilities.clear(); mCharProbabilities.clear();
mDirections.clear();
} }
if (DEBUG_GEO_FULL) { if (DEBUG_GEO_FULL) {
AKLOGI("Init ProximityInfoState: reused points = %d, last input size = %d", AKLOGI("Init ProximityInfoState: reused points = %d, last input size = %d",
@ -216,6 +217,13 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi
mRelativeSpeeds[i] = speed / averageSpeed; mRelativeSpeeds[i] = speed / averageSpeed;
} }
} }
// Direction calculation.
mDirections.resize(mInputSize - 1);
for (int i = max(0, lastSavedInputSize - 1); i < mInputSize - 1; ++i) {
mDirections[i] = getDirection(i, i + 1);
}
} }
if (DEBUG_GEO_FULL) { if (DEBUG_GEO_FULL) {

View File

@ -55,8 +55,8 @@ class ProximityInfoState {
mHasTouchPositionCorrectionData(false), mMostCommonKeyWidthSquare(0), mLocaleStr(), mHasTouchPositionCorrectionData(false), mMostCommonKeyWidthSquare(0), mLocaleStr(),
mKeyCount(0), mCellHeight(0), mCellWidth(0), mGridHeight(0), mGridWidth(0), mKeyCount(0), mCellHeight(0), mCellWidth(0), mGridHeight(0), mGridWidth(0),
mIsContinuationPossible(false), mInputXs(), mInputYs(), mTimes(), mInputIndice(), mIsContinuationPossible(false), mInputXs(), mInputYs(), mTimes(), mInputIndice(),
mDistanceCache(), mLengthCache(), mRelativeSpeeds(), mCharProbabilities(), mDistanceCache(), mLengthCache(), mRelativeSpeeds(), mDirections(),
mNearKeysVector(), mSearchKeysVector(), mCharProbabilities(), mNearKeysVector(), mSearchKeysVector(),
mTouchPositionCorrectionEnabled(false), mInputSize(0) { mTouchPositionCorrectionEnabled(false), mInputSize(0) {
memset(mInputCodes, 0, sizeof(mInputCodes)); memset(mInputCodes, 0, sizeof(mInputCodes));
memset(mNormalizedSquaredDistances, 0, sizeof(mNormalizedSquaredDistances)); memset(mNormalizedSquaredDistances, 0, sizeof(mNormalizedSquaredDistances));
@ -226,6 +226,9 @@ class ProximityInfoState {
return mRelativeSpeeds[index]; return mRelativeSpeeds[index];
} }
float getDirection(const int index) const {
return mDirections[index];
}
// get xy direction // get xy direction
float getDirection(const int x, const int y) const; float getDirection(const int x, const int y) const;
@ -306,6 +309,7 @@ class ProximityInfoState {
std::vector<float> mDistanceCache; std::vector<float> mDistanceCache;
std::vector<int> mLengthCache; std::vector<int> mLengthCache;
std::vector<float> mRelativeSpeeds; std::vector<float> mRelativeSpeeds;
std::vector<float> mDirections;
// probabilities of skipping or mapping to a key for each point. // probabilities of skipping or mapping to a key for each point.
std::vector<hash_map_compat<int, float> > mCharProbabilities; std::vector<hash_map_compat<int, float> > mCharProbabilities;
// The vector for the key code set which holds nearby keys for each sampled input point // The vector for the key code set which holds nearby keys for each sampled input point