bool RotateScreen::adjustVelocity (int size, int invert) { float xrot; if (mMoving) xrot = mMoveTo + (mXrot + mBaseXrot); else { xrot = mXrot; if (mXrot < -180.0f / size) xrot = 360.0f / size + mXrot; else if (mXrot > 180.0f / size) xrot = mXrot - 360.0f / size; } float adjust = -xrot * 0.05f * optionGetAcceleration (); float amount = fabs (xrot); if (amount < 10.0f) amount = 10.0f; else if (amount > 30.0f) amount = 30.0f; if (mSlow) adjust *= 0.05f; mXVelocity = (amount * mXVelocity + adjust) / (amount + 2.0f); float yrot = mYrot; /* Only snap if more than 2 viewports */ if (size > 2) { if (mYrot > 50.0f && ((mSnapTop && invert == 1) || (mSnapBottom && invert != 1))) yrot -= 90.f; else if (mYrot < -50.0f && ((mSnapTop && invert != 1) || (mSnapBottom && invert == 1))) yrot += 90.f; } adjust = -yrot * 0.05f * optionGetAcceleration (); amount = fabs (mYrot); if (amount < 10.0f) amount = 10.0f; else if (amount > 30.0f) amount = 30.0f; mYVelocity = (amount * mYVelocity + adjust) / (amount + 2.0f); return (fabs (xrot) < 0.1f && fabs (mXVelocity) < 0.2f && fabs (yrot) < 0.1f && fabs (mYVelocity) < 0.2f); }
bool PrivateCubeScreen::adjustVelocity () { float unfold, adjust, amount; if (mUnfolded) unfold = 1.0f - mUnfold; else unfold = 0.0f - mUnfold; adjust = unfold * 0.02f * optionGetAcceleration (); amount = fabs (unfold); if (amount < 1.0f) amount = 1.0f; else if (amount > 3.0f) amount = 3.0f; mUnfoldVelocity = (amount * mUnfoldVelocity + adjust) / (amount + 2.0f); return (fabs (unfold) < 0.002f && fabs (mUnfoldVelocity) < 0.01f); }