diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2021-08-08 23:07:02 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2021-08-08 23:07:02 +0200 |
commit | 2ee32abf8411a3fd756dd0a2f08681aed0308116 (patch) | |
tree | 30b2bc7b77e39535db565d955c24d56a68807eba /src/control | |
parent | Merge branch 'master' into miami (diff) | |
download | re3-2ee32abf8411a3fd756dd0a2f08681aed0308116.tar re3-2ee32abf8411a3fd756dd0a2f08681aed0308116.tar.gz re3-2ee32abf8411a3fd756dd0a2f08681aed0308116.tar.bz2 re3-2ee32abf8411a3fd756dd0a2f08681aed0308116.tar.lz re3-2ee32abf8411a3fd756dd0a2f08681aed0308116.tar.xz re3-2ee32abf8411a3fd756dd0a2f08681aed0308116.tar.zst re3-2ee32abf8411a3fd756dd0a2f08681aed0308116.zip |
Diffstat (limited to '')
-rw-r--r-- | src/control/Curves.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/control/Curves.cpp b/src/control/Curves.cpp index 31a2767a..5b590440 100644 --- a/src/control/Curves.cpp +++ b/src/control/Curves.cpp @@ -19,17 +19,27 @@ void CCurves::CalcCurvePoint(CVector* pPos1, CVector* pPos2, CVector* pDir1, CVe float actualFactor = CalcSpeedScaleFactor(pPos1, pPos2, pDir1->x, pDir1->y, pDir2->x, pDir2->y); CVector2D dir1 = *pDir1 * actualFactor; CVector2D dir2 = *pDir2 * actualFactor; - float t1 = Abs(DotProduct2D(*pPos1 - *pPos2, *pDir1)); - float t2 = Abs(DotProduct2D(*pPos2 - *pPos1, *pDir2)); + float t1 = Abs(DotProduct2D(*pPos2 - *pPos1, *pDir1)); + float t2 = Abs(DotProduct2D(*pPos1 - *pPos2, *pDir2)); float curveCoef; if (t1 > t2) { - if (between < (t1 - t2) / (t1 + t2)) + float coef = (t1 - t2) / (t1 + t2); +#ifdef FIX_BUGS + if (between <= coef) +#else + if (between < coef) +#endif curveCoef = 0.0f; else - curveCoef = 0.5f - 0.5f * Cos(3.1415f * (t1 + t2) / (2 * t2) * (between - (t1 - t2) / (t1 + t2))); + curveCoef = 0.5f - 0.5f * Cos(3.1415f * (between - coef) * (t1 + t2) / (2 * t2)); } else { - if (2 * t1 / (t1 + t2) < between) + float coef = 2 * t1 / (t1 + t2); +#ifdef FIX_BUGS + if (coef <= between) +#else + if (coef < between) +#endif curveCoef = 1.0f; else curveCoef = 0.5f - 0.5f * Cos(3.1415f * between * (t1 + t2) / (2 * t1)); |