compass_rose

Build Status MIT License RubyGems :: RMuh Gem Version Coveralls Coverage Code Climate Gemnasium

A tiny gem to convert numerical bearings to their string forms.

LICENSE

compass_rose is released under The MIT License The full text of the license can be found in the LICENSE file. The summary can be found here 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

Something wrong or you want to submit an improvement? Fork the repo, make your changes on a feature branch, write some tests, and submit a pull request. I only ask that the commits have useful information and use proper/complete sentences.

INSTALLATION

gem install compass_rose

Gemfile

gem 'compass_rose'

USAGE

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