Last active
September 30, 2019 10:23
-
-
Save Abdullamhd/f3aa528b6a1abcb6bb144abf0e8dd488 to your computer and use it in GitHub Desktop.
find circomference points from center coordinate
This file contains hidden or 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
import 'dart:math'; | |
/// generate coordnates for cercomfrance | |
void main(){ | |
var radius = 100.0 ; | |
var centerLat = 25.756037 ; | |
var centerLon = 55.969354 ; | |
var points = 10 ; | |
var circlePoints = []; | |
for(var i = 1 ; i < points ; i ++ ){ | |
var angle = pi * 2 * i / points ; | |
var dx = radius * cos(angle); | |
var dy = radius * sin(angle); | |
var point = { | |
'lat' : centerLat + (180 / pi ) * (dy / 6378137) , | |
'long' : centerLon + (180/pi)* (dx / 6378137) / cos(centerLat * pi / 180 ) | |
}; | |
circlePoints.add(point); | |
} | |
circlePoints.forEach(print); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment