Skip to content

Instantly share code, notes, and snippets.

@nimdraugsael
Created July 15, 2013 07:44

Revisions

  1. nimdraugsael created this gist Jul 15, 2013.
    7 changes: 7 additions & 0 deletions gistfile1.coffee
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    angular.module('Map').service 'MapGeometry', ['Underscore', (_) ->
    get: (point_a, point_b) ->
    delta_x = point_b[0] - point_a[0]
    delta_y = point_b[1] - point_a[1]
    cos_alpha = delta_x / Math.sqrt(delta_x*delta_x + delta_y*delta_y)
    Math.acos(cos_alpha) * ((delta_y > 0) ? 1 : -1 )
    ]