https://github.com/theckman/compass_rose
A tiny gem to convert numerical bearings to their string forms
https://github.com/theckman/compass_rose
Last synced: 3 months ago
JSON representation
A tiny gem to convert numerical bearings to their string forms
- Host: GitHub
- URL: https://github.com/theckman/compass_rose
- Owner: theckman
- License: mit
- Created: 2014-03-14T22:55:56.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-06-03T00:34:59.000Z (about 11 years ago)
- Last Synced: 2025-02-28T07:38:57.808Z (4 months ago)
- Language: Ruby
- Size: 680 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
compass_rose
=================
[](https://travis-ci.org/theckman/compass_rose)
[](https://tldrlegal.com/license/mit-license)
[](https://rubygems.org/gems/compass_rose)
[](https://coveralls.io/r/theckman/compass_rose)
[](https://codeclimate.com/github/theckman/compass_rose)
[](https://gemnasium.com/theckman/compass_rose)A tiny gem to convert numerical bearings to their string forms.
LICENSE
-------
`compass_rose` is released under
[The MIT License](http://opensource.org/licenses/MIT) The full text of the
license can be found in the `LICENSE` file. The summary can be found
[here](https://tldrlegal.com/license/mit-license#summary) courtest of
tldrlegal.In short, MIT is a permissive license and means you can pretty much do what you
want with this code as long as the original copyright is included.CONTRIBUTING
------------
See [CONTRIBUTION.md](https://github.com/theckman/compass_rose/blob/master/CONTRIBUTING.md)
for information on contributing back to this project.INSTALLATION
------------```shell
gem install compass_rose
```Gemfile
```Ruby
gem 'compass_rose'
```USAGE
-----```Ruby
require 'compass_rose'
bearing = 232 # directional bearing
points = 16 # the number of points the compass rose should be divided into
d = Compass::Rose.direction(bearing, points)
```At this point, d would contain the direction. This would be a Hash with the
following keys:* `full` - full name of the direction, (i.e. `North by east`,
`North-northeast`, etc.)
* `abbr` - direction's abbrivation (i.e., `N`, `ESE`, `SWbW`, etc.)
* `wind_pt` - the traditional wind point (i.e., `Qto Ponente verso Maestro`)Points
------
A compass rose can be cut in to 4 different sizes: 4, 8, 16, 32. This table
shows which directions are available in the different sizes:| Direction | 4 | 8 | 16 | 32 |
|:------------------:|:-:|:-:|:--:|:--:|
| North | X | X | X | X |
| North by east | | | | X |
| North-northeast | | | X | X |
| Northeast by north | | | | X |
| Northeast | | X | X | X |
| Northeast by east | | | | X |
| East-northeast | | | X | X |
| East by north | | | | X |
| East | X | X | X | X |
| East by south | | | | X |
| East-southeast | | | X | X |
| Southeast by east | | | | X |
| Southeast | | X | X | X |
| Southeast by south | | | | X |
| South-southeast | | | X | X |
| South by east | | | | X |
| South | X | X | X | X |
| South by west | | | | X |
| South-southwest | | | X | X |
| Southwest by south | | | | X |
| Southwest | | X | X | X |
| Southwest by west | | | | X |
| West-southwest | | | X | X |
| West by south | | | | X |
| West | X | X | X | X |
| West by north | | | | X |
| West-northwest | | | X | X |
| Northwest by west | | | | X |
| Northwest | | X | X | X |
| Northwest by north | | | | X |
| North-northwest | | | X | X |
| North by west | | | | X |