By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

I want to implement this code in c++. please help

P: 1
Expand|Select|Wrap|Line Numbers
  1. endpoint.lat = 44.9631;
  2. endpoint.lng = -93.2492;
  3.  
  4. //bus location from the southeast - the circle center
  5. startpoint.lat = 44.95517;
  6. startpoint.lng = -93.2427;
  7.  
  8. function vehicleBearing(endpoint, startpoint) {
  9.     endpoint.lat = x1;
  10.     endpoint.lng = y1;
  11.     startpoint.lat = x2;
  12.     startpoint.lng = y2;
  13.  
  14.     var radians = getAtan2((y1 - y2), (x1 - x2));
  15.  
  16.     function getAtan2(y, x) {
  17.         return Math.atan2(y, x);
  18.     };
  19.  
  20.     var compassReading = radians * (180 / Math.PI);
  21.  
  22.     var coordNames = ["N", "NE", "E", "SE", "S", "SW", "W", "NW", "N"];
  23.     var coordIndex = Math.round(compassReading / 45);
  24.     if (coordIndex < 0) {
  25.         coordIndex = coordIndex + 8
  26.     };
  27.  
  28.     return coordNames[coordIndex]; // returns the coordinate value
  29. }
Sep 18 '17 #1
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,197
What language is this written in?

Why rewrite code in C++?

C++ is able to call functions in other languages by using the appropriate lib/dll library.
Sep 19 '17 #2

Post your reply

Sign in to post your reply or Sign up for a free account.