If (wrap] is desired, it is the responsibility of the caller to handle the case in which min is returned.
This commit is contained in:
Minh Nguyễn
2015-07-02 13:03:32 -07:00
parent 78126f3b6b
commit 46a6173bd7
2 changed files with 4 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ using namespace mbgl;
static double _normalizeAngle(double angle, double anchorAngle)
{
angle = util::wrap(angle, -M_PI, M_PI);
if (angle == -M_PI) angle = M_PI;
double diff = std::abs(angle - anchorAngle);
if (std::abs(angle - util::M2PI - anchorAngle) < diff) {
angle -= util::M2PI;