ph91.de
  • Home
  • About me
  • Categories
    • Software Development
    • New Zealand
    • Music
    • Tech & IT
    • Sports
    • Dublin
    • Junk
  • Contact
  • Disclaimer
ph91.de
ph91.de
  • Home
  • About me
  • Categories
    • Software Development
    • New Zealand
    • Music
    • Tech & IT
    • Sports
    • Dublin
    • Junk
  • Contact
  • Disclaimer
0
0
0
  • Allgemein
  • Software Development

Convert to degree to direction (the beautiful way)

  • 15. August 2020
Total
0
Shares
0
0
0

Recently I encountered the issue of converting a degree in ° (0-360) to a direction (compass directions). On my internet research I only found “ugly” solutions where the minAngle and maxAngle were explicitly listed for each direciont (N, NNE, NE, NEE…).

There was no chance that I would copy such ugly code into my codebase, therefore it made the effort to think about a more beautful way to solve this task. In the end, I came up with this:

Total
0
Shares
Share 0
Tweet 0
Pin it 0
Related Topics
  • direction
  • enum
  • java
Philipp

Previous Article
  • Allgemein

I’m running in Docker

  • 17. February 2020
  • Philipp
View Post
Next Article
action adventure beach clouds
  • Software Development

Creating “Windwarner”

  • 2. January 2021
  • Philipp
View Post

Leave a Reply Cancel reply

Dev profiles
  • BitBucket
  • Github
  • Stackoverflow
Side Projects
  • NMF
  • Speed-kini.de
  • Sudoku Solver
  • Windwarner
Archive
ph91.de
Blog by Philipp Schreitmüller

Input your search keywords and press Enter.

To change your privacy setting, e.g. granting or withdrawing consent, click here: Settings