float ProximityInfo::getNormalizedSquaredDistanceFromCenterFloatG( const int keyId, const int x, const int y, const bool isGeometric) const { const float centerX = static_cast<float>(getKeyCenterXOfKeyIdG(keyId, x, isGeometric)); const float centerY = static_cast<float>(getKeyCenterYOfKeyIdG(keyId, y, isGeometric)); const float touchX = static_cast<float>(x); const float touchY = static_cast<float>(y); return ProximityInfoUtils::getSquaredDistanceFloat(centerX, centerY, touchX, touchY) / GeometryUtils::SQUARE_FLOAT(static_cast<float>(getMostCommonKeyWidth())); }
float ProximityInfo::getNormalizedSquaredDistanceFromCenterFloatG( const int keyId, const int x, const int y, const float verticalScale) const { const bool correctTouchPosition = hasTouchPositionCorrectionData(); const float centerX = static_cast<float>(correctTouchPosition ? getSweetSpotCenterXAt(keyId) : getKeyCenterXOfKeyIdG(keyId)); const float visualKeyCenterY = static_cast<float>(getKeyCenterYOfKeyIdG(keyId)); float centerY; if (correctTouchPosition) { const float sweetSpotCenterY = static_cast<float>(getSweetSpotCenterYAt(keyId)); const float gapY = sweetSpotCenterY - visualKeyCenterY; centerY = visualKeyCenterY + gapY * verticalScale; } else { centerY = visualKeyCenterY; } const float touchX = static_cast<float>(x); const float touchY = static_cast<float>(y); const float keyWidth = static_cast<float>(getMostCommonKeyWidth()); return ProximityInfoUtils::getSquaredDistanceFloat(centerX, centerY, touchX, touchY) / SQUARE_FLOAT(keyWidth); }
int ProximityInfo::getKeyCenterXOfCodePointG(int charCode) const { return getKeyCenterXOfKeyIdG( ProximityInfoUtils::getKeyIndexOf(KEY_COUNT, charCode, &mCodeToKeyMap)); }