Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static float[] RotateVector(float[] v, float degrees)
- {
- float sin = (float)Math.Sin(degrees * 0.0174553294f);
- float cos = (float)Math.Cos(degrees * 0.0174553294f);
- float tx = v[0];
- float ty = v[1];
- return new float[] { (cos * tx) - (sin * ty), (sin * tx) + (cos * ty) };
- }
- static void Main(string[] args)
- {
- float lat = 53.1324886f;
- float lon = 23.1688403f;
- float R = 6378137;
- float distance = 100;
- float dn = 0;
- float de = 1;
- float[] rotation = RotateVector(new float[] { dn, de }, 180);
- rotation[0] = rotation[0] * distance;
- rotation[1] = rotation[1] * distance;
- float dLat = rotation[0] / R;
- float dLon = rotation[1] / (R * (float)Math.Cos(Math.PI * lat / 180));
- float latO = lat + dLat * 180 / (float)Math.PI;
- float lonO = lon + dLon * 180 / (float)Math.PI;
- Console.WriteLine(latO+" "+ lonO);
- Console.ReadKey();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement