-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
158 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef OSRM_INCLUDE_GUIDANCE_TURN_BEARING_HPP_ | ||
#define OSRM_INCLUDE_GUIDANCE_TURN_BEARING_HPP_ | ||
|
||
#include <cstdint> | ||
|
||
#include <boost/assert.hpp> | ||
|
||
namespace osrm | ||
{ | ||
namespace guidance | ||
{ | ||
namespace | ||
{ | ||
const double bearing_scale = 360.0 / 256.0; | ||
} | ||
|
||
#pragma pack(push, 1) | ||
class TurnBearing | ||
{ | ||
public: | ||
// discretizes a bearing into distinct units of 1.4 degrees | ||
TurnBearing(const double value = 0) : bearing(value / bearing_scale) | ||
{ | ||
BOOST_ASSERT_MSG(value >= 0 && value < 360.0, | ||
"Bearing value needs to be between 0 and 360 (exclusive)"); | ||
} | ||
|
||
double Get() const { return bearing * bearing_scale; } | ||
|
||
private: | ||
std::uint8_t bearing; | ||
}; | ||
#pragma pack(pop) | ||
|
||
} // namespace guidance | ||
} // namespace osrm | ||
|
||
#endif /* OSRM_INCLUDE_GUIDANCE_TURN_BEARING_HPP_ */ |
Oops, something went wrong.