{"action":"created","comment":{"url":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/comments/36643488","id":36643488,"diff_hunk":"@@ -77,6 +84,118 @@ WXYZ ToWXYZ(Quaternion const& quaternion) {\n           quaternion.imaginary_part().z};\n }\n \n+// Similar to std::stod, but uses LOG(FATAL) instead of exceptions.\n+double ParseDouble(std::string const& s, not_null<size_t*> size) {\n+  char* interpreted_end;\n+  char const* const c_string = s.c_str();\n+  double result = std::strtod(c_string, &interpreted_end);\n+  *size = interpreted_end - c_string;\n+  CHECK_GT(*size, 0) << \"invalid floating-point number \" << s;\n+  return result;\n+}\n+\n+double ParseQuantity(std::string const& s, not_null<std::string*> unit) {\n+  size_t i;\n+  double magnitude = ParseDouble(s, &i);\n+  for (*unit = \"\"; i < s.length(); ++i) {\n+    if (!std::isspace(s[i])) {\n+      *unit += s[i];\n+    }\n+  }\n+  return magnitude;\n+}\n+\n+// TODO(egg): actual parser.\n+\n+Length ParseLength(std::string const& s) {\n+  std::string unit;\n+  double magnitude = ParseQuantity(s, &unit);\n+  if (unit == \"m\") {\n+    return magnitude * Metre;\n+  } else if (unit == \"km\") {\n+    return magnitude * Kilo(Metre);\n+  } else if (unit == \"au\") {\n+    return magnitude * AstronomicalUnit;\n+  } else {\n+    LOG(FATAL) << \"unsupported unit of length \" << unit;\n+    base::noreturn();\n+  }\n+}\n+\n+Speed ParseSpeed(std::string const& s) {\n+  std::string unit;\n+  double magnitude = ParseQuantity(s, &unit);\n+  if (unit == \"m/s\") {\n+    return magnitude * Metre / Second;\n+  } else if (unit == \"km/s\") {\n+    return magnitude * Kilo(Metre) / Second;\n+  } else if (unit == \"km/d\") {\n+    return magnitude * Kilo(Metre) / Day;\n+  } else if (unit == \"au/d\") {\n+    return magnitude * AstronomicalUnit / Day;\n+  } else {\n+    LOG(FATAL) << \"unsupported unit of speed \" << unit;\n+    base::noreturn();\n+  }\n+}\n+\n+Angle ParseAngle(std::string const& s) {\n+  std::string unit;\n+  double magnitude = ParseQuantity(s, &unit);\n+  if (unit == \"deg\" || unit == \"�\") {\n+    return magnitude * Degree;\n+  } else if (unit == \"rad\") {\n+    return magnitude * Radian;\n+  } else {\n+    LOG(FATAL) << \"unsupported unit of angle \" << unit;\n+    base::noreturn();\n+  }\n+}\n+\n+GravitationalParameter ParseGravitationalParameter(std::string const& s) {\n+  std::string unit;\n+  double magnitude = ParseQuantity(s, &unit);\n+  if (unit == \"m^3/s^2\") {\n+    return magnitude * Pow<3>(Metre) / Pow<2>(Second);\n+  } else if (unit == \"km^3/s^2\") {\n+    return magnitude * Pow<3>(Kilo(Metre)) / Pow<2>(Second);\n+  } else if (unit == \"km^3/d^2\") {\n+    return magnitude * Pow<3>(Kilo(Metre)) / Pow<2>(Day);\n+  } else if (unit == \"au^3/d^2\") {\n+    return magnitude * Pow<3>(AstronomicalUnit) / Pow<2>(Day);\n+  } else {\n+    LOG(FATAL) << \"unsupported unit of gravitational parameter \" << unit;\n+    base::noreturn();\n+  }\n+}\n+\n+double ParseDimensionless(std::string const& s) {\n+  std::string unit;\n+  double magnitude = ParseQuantity(s, &unit);\n+  CHECK_EQ(unit, \"\");\n+  return magnitude;\n+}\n+\n+// Returns a unit vector pointing in the direction defined by |right_ascension|\n+// and |declination|, assuming the reference system is as follows:\n+// xy-plane: plane of the Earth's mean equator at the reference epoch\n+// x-axis  : out along ascending node of instantaneous plane of the Earth's\n+//           orbit and the Earth's mean equator at the reference epoch\n+// z-axis  : along the Earth mean north pole at the reference epoch\n+Vector<double, Barycentric> Direction(Angle const& right_ascension,\n+                                           Angle const& declination) {","path":"ksp_plugin/interface.cpp","position":126,"original_position":125,"commit_id":"73959b119f545e7e29f751d9d370c102ada2b896","original_commit_id":"becef7d65392e208d4bd2abf50bfd6c71c9dcb4c","user":{"login":"pleroy","id":7423020,"avatar_url":"https://avatars.githubusercontent.com/u/7423020?v=3","gravatar_id":"","url":"https://api.github.com/users/pleroy","html_url":"https://github.com/pleroy","followers_url":"https://api.github.com/users/pleroy/followers","following_url":"https://api.github.com/users/pleroy/following{/other_user}","gists_url":"https://api.github.com/users/pleroy/gists{/gist_id}","starred_url":"https://api.github.com/users/pleroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pleroy/subscriptions","organizations_url":"https://api.github.com/users/pleroy/orgs","repos_url":"https://api.github.com/users/pleroy/repos","events_url":"https://api.github.com/users/pleroy/events{/privacy}","received_events_url":"https://api.github.com/users/pleroy/received_events","type":"User","site_admin":false},"body":"Bad indent.","created_at":"2015-08-10T15:21:28Z","updated_at":"2015-08-10T15:21:28Z","html_url":"https://github.com/mockingbirdnest/Principia/pull/613#discussion_r36643488","pull_request_url":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/613","_links":{"self":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/comments/36643488"},"html":{"href":"https://github.com/mockingbirdnest/Principia/pull/613#discussion_r36643488"},"pull_request":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/613"}}},"pull_request":{"url":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/613","id":41976774,"html_url":"https://github.com/mockingbirdnest/Principia/pull/613","diff_url":"https://github.com/mockingbirdnest/Principia/pull/613.diff","patch_url":"https://github.com/mockingbirdnest/Principia/pull/613.patch","issue_url":"https://api.github.com/repos/mockingbirdnest/Principia/issues/613","number":613,"state":"open","locked":false,"title":"Initial state config suport","user":{"login":"eggrobin","id":2284290,"avatar_url":"https://avatars.githubusercontent.com/u/2284290?v=3","gravatar_id":"","url":"https://api.github.com/users/eggrobin","html_url":"https://github.com/eggrobin","followers_url":"https://api.github.com/users/eggrobin/followers","following_url":"https://api.github.com/users/eggrobin/following{/other_user}","gists_url":"https://api.github.com/users/eggrobin/gists{/gist_id}","starred_url":"https://api.github.com/users/eggrobin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eggrobin/subscriptions","organizations_url":"https://api.github.com/users/eggrobin/orgs","repos_url":"https://api.github.com/users/eggrobin/repos","events_url":"https://api.github.com/users/eggrobin/events{/privacy}","received_events_url":"https://api.github.com/users/eggrobin/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-09T20:48:21Z","updated_at":"2015-08-10T15:21:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d4fb2fc8ab46671dfe4906015acd847c95eed2dc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/613/commits","review_comments_url":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/613/comments","review_comment_url":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mockingbirdnest/Principia/issues/613/comments","statuses_url":"https://api.github.com/repos/mockingbirdnest/Principia/statuses/73959b119f545e7e29f751d9d370c102ada2b896","head":{"label":"eggrobin:initial-state","ref":"initial-state","sha":"73959b119f545e7e29f751d9d370c102ada2b896","user":{"login":"eggrobin","id":2284290,"avatar_url":"https://avatars.githubusercontent.com/u/2284290?v=3","gravatar_id":"","url":"https://api.github.com/users/eggrobin","html_url":"https://github.com/eggrobin","followers_url":"https://api.github.com/users/eggrobin/followers","following_url":"https://api.github.com/users/eggrobin/following{/other_user}","gists_url":"https://api.github.com/users/eggrobin/gists{/gist_id}","starred_url":"https://api.github.com/users/eggrobin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eggrobin/subscriptions","organizations_url":"https://api.github.com/users/eggrobin/orgs","repos_url":"https://api.github.com/users/eggrobin/repos","events_url":"https://api.github.com/users/eggrobin/events{/privacy}","received_events_url":"https://api.github.com/users/eggrobin/received_events","type":"User","site_admin":false},"repo":{"id":19360849,"name":"Principia","full_name":"eggrobin/Principia","owner":{"login":"eggrobin","id":2284290,"avatar_url":"https://avatars.githubusercontent.com/u/2284290?v=3","gravatar_id":"","url":"https://api.github.com/users/eggrobin","html_url":"https://github.com/eggrobin","followers_url":"https://api.github.com/users/eggrobin/followers","following_url":"https://api.github.com/users/eggrobin/following{/other_user}","gists_url":"https://api.github.com/users/eggrobin/gists{/gist_id}","starred_url":"https://api.github.com/users/eggrobin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eggrobin/subscriptions","organizations_url":"https://api.github.com/users/eggrobin/orgs","repos_url":"https://api.github.com/users/eggrobin/repos","events_url":"https://api.github.com/users/eggrobin/events{/privacy}","received_events_url":"https://api.github.com/users/eggrobin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eggrobin/Principia","description":"N-Body Gravitation and Better Integrators for Kerbal Space Program","fork":true,"url":"https://api.github.com/repos/eggrobin/Principia","forks_url":"https://api.github.com/repos/eggrobin/Principia/forks","keys_url":"https://api.github.com/repos/eggrobin/Principia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eggrobin/Principia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eggrobin/Principia/teams","hooks_url":"https://api.github.com/repos/eggrobin/Principia/hooks","issue_events_url":"https://api.github.com/repos/eggrobin/Principia/issues/events{/number}","events_url":"https://api.github.com/repos/eggrobin/Principia/events","assignees_url":"https://api.github.com/repos/eggrobin/Principia/assignees{/user}","branches_url":"https://api.github.com/repos/eggrobin/Principia/branches{/branch}","tags_url":"https://api.github.com/repos/eggrobin/Principia/tags","blobs_url":"https://api.github.com/repos/eggrobin/Principia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eggrobin/Principia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eggrobin/Principia/git/refs{/sha}","trees_url":"https://api.github.com/repos/eggrobin/Principia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eggrobin/Principia/statuses/{sha}","languages_url":"https://api.github.com/repos/eggrobin/Principia/languages","stargazers_url":"https://api.github.com/repos/eggrobin/Principia/stargazers","contributors_url":"https://api.github.com/repos/eggrobin/Principia/contributors","subscribers_url":"https://api.github.com/repos/eggrobin/Principia/subscribers","subscription_url":"https://api.github.com/repos/eggrobin/Principia/subscription","commits_url":"https://api.github.com/repos/eggrobin/Principia/commits{/sha}","git_commits_url":"https://api.github.com/repos/eggrobin/Principia/git/commits{/sha}","comments_url":"https://api.github.com/repos/eggrobin/Principia/comments{/number}","issue_comment_url":"https://api.github.com/repos/eggrobin/Principia/issues/comments{/number}","contents_url":"https://api.github.com/repos/eggrobin/Principia/contents/{+path}","compare_url":"https://api.github.com/repos/eggrobin/Principia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eggrobin/Principia/merges","archive_url":"https://api.github.com/repos/eggrobin/Principia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eggrobin/Principia/downloads","issues_url":"https://api.github.com/repos/eggrobin/Principia/issues{/number}","pulls_url":"https://api.github.com/repos/eggrobin/Principia/pulls{/number}","milestones_url":"https://api.github.com/repos/eggrobin/Principia/milestones{/number}","notifications_url":"https://api.github.com/repos/eggrobin/Principia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eggrobin/Principia/labels{/name}","releases_url":"https://api.github.com/repos/eggrobin/Principia/releases{/id}","created_at":"2014-05-01T23:29:34Z","updated_at":"2015-04-07T03:56:10Z","pushed_at":"2015-08-10T08:14:07Z","git_url":"git://github.com/eggrobin/Principia.git","ssh_url":"git@github.com:eggrobin/Principia.git","clone_url":"https://github.com/eggrobin/Principia.git","svn_url":"https://github.com/eggrobin/Principia","homepage":"http://forum.kerbalspaceprogram.com/threads/68502-WIP-Principia-N-Body-Gravitation-and-Better-Integrators-for-Kerbal-Space-Program","size":23482,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"mockingbirdnest:master","ref":"master","sha":"97032af6e729b70428dbffbf67b1a0d61ea77d02","user":{"login":"mockingbirdnest","id":7462691,"avatar_url":"https://avatars.githubusercontent.com/u/7462691?v=3","gravatar_id":"","url":"https://api.github.com/users/mockingbirdnest","html_url":"https://github.com/mockingbirdnest","followers_url":"https://api.github.com/users/mockingbirdnest/followers","following_url":"https://api.github.com/users/mockingbirdnest/following{/other_user}","gists_url":"https://api.github.com/users/mockingbirdnest/gists{/gist_id}","starred_url":"https://api.github.com/users/mockingbirdnest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mockingbirdnest/subscriptions","organizations_url":"https://api.github.com/users/mockingbirdnest/orgs","repos_url":"https://api.github.com/users/mockingbirdnest/repos","events_url":"https://api.github.com/users/mockingbirdnest/events{/privacy}","received_events_url":"https://api.github.com/users/mockingbirdnest/received_events","type":"Organization","site_admin":false},"repo":{"id":16634370,"name":"Principia","full_name":"mockingbirdnest/Principia","owner":{"login":"mockingbirdnest","id":7462691,"avatar_url":"https://avatars.githubusercontent.com/u/7462691?v=3","gravatar_id":"","url":"https://api.github.com/users/mockingbirdnest","html_url":"https://github.com/mockingbirdnest","followers_url":"https://api.github.com/users/mockingbirdnest/followers","following_url":"https://api.github.com/users/mockingbirdnest/following{/other_user}","gists_url":"https://api.github.com/users/mockingbirdnest/gists{/gist_id}","starred_url":"https://api.github.com/users/mockingbirdnest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mockingbirdnest/subscriptions","organizations_url":"https://api.github.com/users/mockingbirdnest/orgs","repos_url":"https://api.github.com/users/mockingbirdnest/repos","events_url":"https://api.github.com/users/mockingbirdnest/events{/privacy}","received_events_url":"https://api.github.com/users/mockingbirdnest/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mockingbirdnest/Principia","description":"N-Body Gravitation and Better Integrators for Kerbal Space Program","fork":false,"url":"https://api.github.com/repos/mockingbirdnest/Principia","forks_url":"https://api.github.com/repos/mockingbirdnest/Principia/forks","keys_url":"https://api.github.com/repos/mockingbirdnest/Principia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mockingbirdnest/Principia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mockingbirdnest/Principia/teams","hooks_url":"https://api.github.com/repos/mockingbirdnest/Principia/hooks","issue_events_url":"https://api.github.com/repos/mockingbirdnest/Principia/issues/events{/number}","events_url":"https://api.github.com/repos/mockingbirdnest/Principia/events","assignees_url":"https://api.github.com/repos/mockingbirdnest/Principia/assignees{/user}","branches_url":"https://api.github.com/repos/mockingbirdnest/Principia/branches{/branch}","tags_url":"https://api.github.com/repos/mockingbirdnest/Principia/tags","blobs_url":"https://api.github.com/repos/mockingbirdnest/Principia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mockingbirdnest/Principia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mockingbirdnest/Principia/git/refs{/sha}","trees_url":"https://api.github.com/repos/mockingbirdnest/Principia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mockingbirdnest/Principia/statuses/{sha}","languages_url":"https://api.github.com/repos/mockingbirdnest/Principia/languages","stargazers_url":"https://api.github.com/repos/mockingbirdnest/Principia/stargazers","contributors_url":"https://api.github.com/repos/mockingbirdnest/Principia/contributors","subscribers_url":"https://api.github.com/repos/mockingbirdnest/Principia/subscribers","subscription_url":"https://api.github.com/repos/mockingbirdnest/Principia/subscription","commits_url":"https://api.github.com/repos/mockingbirdnest/Principia/commits{/sha}","git_commits_url":"https://api.github.com/repos/mockingbirdnest/Principia/git/commits{/sha}","comments_url":"https://api.github.com/repos/mockingbirdnest/Principia/comments{/number}","issue_comment_url":"https://api.github.com/repos/mockingbirdnest/Principia/issues/comments{/number}","contents_url":"https://api.github.com/repos/mockingbirdnest/Principia/contents/{+path}","compare_url":"https://api.github.com/repos/mockingbirdnest/Principia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mockingbirdnest/Principia/merges","archive_url":"https://api.github.com/repos/mockingbirdnest/Principia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mockingbirdnest/Principia/downloads","issues_url":"https://api.github.com/repos/mockingbirdnest/Principia/issues{/number}","pulls_url":"https://api.github.com/repos/mockingbirdnest/Principia/pulls{/number}","milestones_url":"https://api.github.com/repos/mockingbirdnest/Principia/milestones{/number}","notifications_url":"https://api.github.com/repos/mockingbirdnest/Principia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mockingbirdnest/Principia/labels{/name}","releases_url":"https://api.github.com/repos/mockingbirdnest/Principia/releases{/id}","created_at":"2014-02-08T02:55:32Z","updated_at":"2015-07-23T18:18:03Z","pushed_at":"2015-08-10T08:14:08Z","git_url":"git://github.com/mockingbirdnest/Principia.git","ssh_url":"git@github.com:mockingbirdnest/Principia.git","clone_url":"https://github.com/mockingbirdnest/Principia.git","svn_url":"https://github.com/mockingbirdnest/Principia","homepage":"http://forum.kerbalspaceprogram.com/threads/68502-WIP-Principia-N-Body-Gravitation-and-Better-Integrators-for-Kerbal-Space-Program","size":23217,"stargazers_count":83,"watchers_count":83,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":29,"forks":8,"open_issues":29,"watchers":83,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/613"},"html":{"href":"https://github.com/mockingbirdnest/Principia/pull/613"},"issue":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/issues/613"},"comments":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/issues/613/comments"},"review_comments":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/613/comments"},"review_comment":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/613/commits"},"statuses":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/statuses/73959b119f545e7e29f751d9d370c102ada2b896"}}}}