{"action":"created","comment":{"url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/comments/57339645","id":57339645,"diff_hunk":"@@ -95,6 +97,109 @@ inline bool isRampClass(EdgeID eid, const util::NodeBasedDynamicGraph &node_base\n \n } // namespace detail\n \n+bool TurnAnalysis::isRotary(const NodeID nid) const\n+{\n+    // translate a node ID into its respective coordinate stored in the node_info_list\n+    const auto getCoordinate = [this](const NodeID node)\n+    {\n+        return util::Coordinate(node_info_list[node].lon, node_info_list[node].lat);\n+    };\n+\n+    unsigned roundabout_name = 0;\n+    std::set<unsigned> connected_names;\n+\n+    const auto getNextOnRoundabout = [this, &roundabout_name, &connected_names](const NodeID node)\n+    {\n+        EdgeID continue_edge = SPECIAL_EDGEID;\n+        for (const auto edge : node_based_graph.GetAdjacentEdgeRange(node))\n+        {\n+            const auto &edge_data = node_based_graph.GetEdgeData(edge);\n+            if (!edge_data.reversed && edge_data.roundabout)\n+            {\n+                if (SPECIAL_EDGEID != continue_edge)\n+                {\n+                    // fork in roundabout\n+                    return SPECIAL_EDGEID;\n+                }\n+                // roundabout does not keep its name\n+                if (roundabout_name != 0 && roundabout_name != edge_data.name_id &&\n+                    requiresNameAnnounced(name_table.GetNameForID(roundabout_name),\n+                                          name_table.GetNameForID(edge_data.name_id)))\n+                {\n+                    return SPECIAL_EDGEID;\n+                }\n+\n+                roundabout_name = edge_data.name_id;\n+\n+                continue_edge = edge;\n+            }\n+            else if (!edge_data.roundabout)\n+            {\n+                // remember all connected road names\n+                connected_names.insert(edge_data.name_id);\n+            }\n+        }\n+        return continue_edge;\n+    };\n+\n+    // the roundabout radius has to be the same for all locations we look at it from\n+    // to guarantee this, we search the full roundabout for its vertices\n+    // and select the three smalles ids\n+    std::vector<NodeID> roundabout_nodes;\n+    roundabout_nodes.reserve(40);\n+    roundabout_nodes.push_back(nid);\n+    while (roundabout_nodes.size() < 40) // hard abort if something is wrong\n+    {\n+        auto eid = getNextOnRoundabout(roundabout_nodes.back());\n+\n+        if (eid == SPECIAL_EDGEID)\n+        {\n+            util::SimpleLogger().Write(logDEBUG) << \"Non-Loop Roundabout found.\";\n+            return false;\n+        }\n+\n+        roundabout_nodes.push_back(node_based_graph.GetTarget(eid));\n+\n+        if (roundabout_nodes.back() == roundabout_nodes.front()) // circled the roundabout\n+        {\n+            roundabout_nodes.pop_back();\n+            break;\n+        }\n+    }\n+\n+    // do we have a dedicated name for the rotary, if not its a roundabout\n+    if (roundabout_name == 0 || connected_names.count(roundabout_name))\n+    {\n+        return false;\n+    }\n+\n+    if (roundabout_nodes.size() <= 1)\n+    {\n+        return false;\n+    }\n+\n+    std::sort(roundabout_nodes.begin(), roundabout_nodes.end());\n+\n+    // calculate the radius of the roundabout/rotary. For two coordinates, we assume a minimal\n+    // circle\n+    // with both vertices right at the other side (so half their distance in meters).\n+    // Otherwise, we construct a circle through the first tree vertices.\n+    const double radius =\n+        roundabout_nodes.size() >= 3\n+            ? util::coordinate_calculation::circleRadius(getCoordinate(roundabout_nodes[0]),\n+                                                         getCoordinate(roundabout_nodes[1]),\n+                                                         getCoordinate(roundabout_nodes[2]))\n+            : 0.5 * util::coordinate_calculation::haversineDistance(\n+                        getCoordinate(roundabout_nodes[0]), getCoordinate(roundabout_nodes[1]));\n+\n+    // check whether the circle computation has gone wrong\n+    if (std::isinf(radius))\n+        return false;","path":"src/extractor/guidance/turn_analysis.cpp","position":null,"original_position":114,"commit_id":"3cfa419ae582cae82cd30f06f8252672ee0488ff","original_commit_id":"8c1401d6b6b1c432c6413a472dffb062bff6078e","user":{"login":"daniel-j-h","id":527241,"avatar_url":"https://avatars.githubusercontent.com/u/527241?v=3","gravatar_id":"","url":"https://api.github.com/users/daniel-j-h","html_url":"https://github.com/daniel-j-h","followers_url":"https://api.github.com/users/daniel-j-h/followers","following_url":"https://api.github.com/users/daniel-j-h/following{/other_user}","gists_url":"https://api.github.com/users/daniel-j-h/gists{/gist_id}","starred_url":"https://api.github.com/users/daniel-j-h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daniel-j-h/subscriptions","organizations_url":"https://api.github.com/users/daniel-j-h/orgs","repos_url":"https://api.github.com/users/daniel-j-h/repos","events_url":"https://api.github.com/users/daniel-j-h/events{/privacy}","received_events_url":"https://api.github.com/users/daniel-j-h/received_events","type":"User","site_admin":false},"body":"Hm at least add a comment for that particular situation :+1: ","created_at":"2016-03-24T15:57:40Z","updated_at":"2016-03-24T15:57:40Z","html_url":"https://github.com/Project-OSRM/osrm-backend/pull/2135#discussion_r57339645","pull_request_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/2135","_links":{"self":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/comments/57339645"},"html":{"href":"https://github.com/Project-OSRM/osrm-backend/pull/2135#discussion_r57339645"},"pull_request":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/2135"}}},"pull_request":{"url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/2135","id":63891308,"html_url":"https://github.com/Project-OSRM/osrm-backend/pull/2135","diff_url":"https://github.com/Project-OSRM/osrm-backend/pull/2135.diff","patch_url":"https://github.com/Project-OSRM/osrm-backend/pull/2135.patch","issue_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/2135","number":2135,"state":"open","locked":false,"title":"[WIP] adds a distinction between roundabouts and rotaries","user":{"login":"MoKob","id":12932279,"avatar_url":"https://avatars.githubusercontent.com/u/12932279?v=3","gravatar_id":"","url":"https://api.github.com/users/MoKob","html_url":"https://github.com/MoKob","followers_url":"https://api.github.com/users/MoKob/followers","following_url":"https://api.github.com/users/MoKob/following{/other_user}","gists_url":"https://api.github.com/users/MoKob/gists{/gist_id}","starred_url":"https://api.github.com/users/MoKob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MoKob/subscriptions","organizations_url":"https://api.github.com/users/MoKob/orgs","repos_url":"https://api.github.com/users/MoKob/repos","events_url":"https://api.github.com/users/MoKob/events{/privacy}","received_events_url":"https://api.github.com/users/MoKob/received_events","type":"User","site_admin":false},"body":"Some larger rotaries have distinct names and should be handled differently from the pure roundabouts.\r\nA roundabout is usually a small circle at an intersection.\r\n\r\nThis will unlock instructions of the form `at Logan Circle take the 4th exit` and the roundabout-turns (`at the roundabout turn left`).\r\n\r\nTasks:\r\n - [x] compute radius of roundabout\r\n       - [x] implement radius of a circle\r\n       - [x] find consistent roundabout size\r\n\r\n - [x] determine threshold / rules for distinction between rotary and roundabout (see below)\r\n - [x] implement distinction in `handleRoundabouts` moved to a dedicated function\r\n\r\n - [ ] review\r\n - [ ] on merge: update API for new instruction/new data and handle in API (@karenzshea)\r\n       Proposal: `rotary | a special (often named) roundabout -- can offer additional_name as attribute`\r\n       or: `additional_name` a roundabout may specify an `additional_name` to indicate the name of the roundabout itself. ","created_at":"2016-03-23T14:34:39Z","updated_at":"2016-03-24T15:57:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f7193a7465fe0490470817214cc57db8b43e3f08","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/2135/commits","review_comments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/2135/comments","review_comment_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/2135/comments","statuses_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/statuses/3cfa419ae582cae82cd30f06f8252672ee0488ff","head":{"label":"Project-OSRM:features/guidance/rotaries","ref":"features/guidance/rotaries","sha":"3cfa419ae582cae82cd30f06f8252672ee0488ff","user":{"login":"Project-OSRM","id":8207060,"avatar_url":"https://avatars.githubusercontent.com/u/8207060?v=3","gravatar_id":"","url":"https://api.github.com/users/Project-OSRM","html_url":"https://github.com/Project-OSRM","followers_url":"https://api.github.com/users/Project-OSRM/followers","following_url":"https://api.github.com/users/Project-OSRM/following{/other_user}","gists_url":"https://api.github.com/users/Project-OSRM/gists{/gist_id}","starred_url":"https://api.github.com/users/Project-OSRM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Project-OSRM/subscriptions","organizations_url":"https://api.github.com/users/Project-OSRM/orgs","repos_url":"https://api.github.com/users/Project-OSRM/repos","events_url":"https://api.github.com/users/Project-OSRM/events{/privacy}","received_events_url":"https://api.github.com/users/Project-OSRM/received_events","type":"Organization","site_admin":false},"repo":{"id":2436255,"name":"osrm-backend","full_name":"Project-OSRM/osrm-backend","owner":{"login":"Project-OSRM","id":8207060,"avatar_url":"https://avatars.githubusercontent.com/u/8207060?v=3","gravatar_id":"","url":"https://api.github.com/users/Project-OSRM","html_url":"https://github.com/Project-OSRM","followers_url":"https://api.github.com/users/Project-OSRM/followers","following_url":"https://api.github.com/users/Project-OSRM/following{/other_user}","gists_url":"https://api.github.com/users/Project-OSRM/gists{/gist_id}","starred_url":"https://api.github.com/users/Project-OSRM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Project-OSRM/subscriptions","organizations_url":"https://api.github.com/users/Project-OSRM/orgs","repos_url":"https://api.github.com/users/Project-OSRM/repos","events_url":"https://api.github.com/users/Project-OSRM/events{/privacy}","received_events_url":"https://api.github.com/users/Project-OSRM/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Project-OSRM/osrm-backend","description":"Project OSRM: C++ backend","fork":false,"url":"https://api.github.com/repos/Project-OSRM/osrm-backend","forks_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/forks","keys_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/teams","hooks_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/hooks","issue_events_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/events{/number}","events_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/events","assignees_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/assignees{/user}","branches_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/branches{/branch}","tags_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/tags","blobs_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/languages","stargazers_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/stargazers","contributors_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/contributors","subscribers_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/subscribers","subscription_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/subscription","commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/contents/{+path}","compare_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/merges","archive_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/downloads","issues_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues{/number}","pulls_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/labels{/name}","releases_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/releases{/id}","deployments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/deployments","created_at":"2011-09-22T10:05:08Z","updated_at":"2016-03-24T11:51:30Z","pushed_at":"2016-03-24T15:31:57Z","git_url":"git://github.com/Project-OSRM/osrm-backend.git","ssh_url":"git@github.com:Project-OSRM/osrm-backend.git","clone_url":"https://github.com/Project-OSRM/osrm-backend.git","svn_url":"https://github.com/Project-OSRM/osrm-backend","homepage":"http://map.project-osrm.org","size":21490,"stargazers_count":1096,"watchers_count":1096,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":561,"mirror_url":null,"open_issues_count":218,"forks":561,"open_issues":218,"watchers":1096,"default_branch":"develop"}},"base":{"label":"Project-OSRM:rewrite/new-api","ref":"rewrite/new-api","sha":"e1e76d04d1cfed8ca561638db2329252a1f15f16","user":{"login":"Project-OSRM","id":8207060,"avatar_url":"https://avatars.githubusercontent.com/u/8207060?v=3","gravatar_id":"","url":"https://api.github.com/users/Project-OSRM","html_url":"https://github.com/Project-OSRM","followers_url":"https://api.github.com/users/Project-OSRM/followers","following_url":"https://api.github.com/users/Project-OSRM/following{/other_user}","gists_url":"https://api.github.com/users/Project-OSRM/gists{/gist_id}","starred_url":"https://api.github.com/users/Project-OSRM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Project-OSRM/subscriptions","organizations_url":"https://api.github.com/users/Project-OSRM/orgs","repos_url":"https://api.github.com/users/Project-OSRM/repos","events_url":"https://api.github.com/users/Project-OSRM/events{/privacy}","received_events_url":"https://api.github.com/users/Project-OSRM/received_events","type":"Organization","site_admin":false},"repo":{"id":2436255,"name":"osrm-backend","full_name":"Project-OSRM/osrm-backend","owner":{"login":"Project-OSRM","id":8207060,"avatar_url":"https://avatars.githubusercontent.com/u/8207060?v=3","gravatar_id":"","url":"https://api.github.com/users/Project-OSRM","html_url":"https://github.com/Project-OSRM","followers_url":"https://api.github.com/users/Project-OSRM/followers","following_url":"https://api.github.com/users/Project-OSRM/following{/other_user}","gists_url":"https://api.github.com/users/Project-OSRM/gists{/gist_id}","starred_url":"https://api.github.com/users/Project-OSRM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Project-OSRM/subscriptions","organizations_url":"https://api.github.com/users/Project-OSRM/orgs","repos_url":"https://api.github.com/users/Project-OSRM/repos","events_url":"https://api.github.com/users/Project-OSRM/events{/privacy}","received_events_url":"https://api.github.com/users/Project-OSRM/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Project-OSRM/osrm-backend","description":"Project OSRM: C++ backend","fork":false,"url":"https://api.github.com/repos/Project-OSRM/osrm-backend","forks_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/forks","keys_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/teams","hooks_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/hooks","issue_events_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/events{/number}","events_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/events","assignees_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/assignees{/user}","branches_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/branches{/branch}","tags_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/tags","blobs_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/languages","stargazers_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/stargazers","contributors_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/contributors","subscribers_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/subscribers","subscription_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/subscription","commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/contents/{+path}","compare_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/merges","archive_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/downloads","issues_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues{/number}","pulls_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/labels{/name}","releases_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/releases{/id}","deployments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/deployments","created_at":"2011-09-22T10:05:08Z","updated_at":"2016-03-24T11:51:30Z","pushed_at":"2016-03-24T15:31:57Z","git_url":"git://github.com/Project-OSRM/osrm-backend.git","ssh_url":"git@github.com:Project-OSRM/osrm-backend.git","clone_url":"https://github.com/Project-OSRM/osrm-backend.git","svn_url":"https://github.com/Project-OSRM/osrm-backend","homepage":"http://map.project-osrm.org","size":21490,"stargazers_count":1096,"watchers_count":1096,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":561,"mirror_url":null,"open_issues_count":218,"forks":561,"open_issues":218,"watchers":1096,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/2135"},"html":{"href":"https://github.com/Project-OSRM/osrm-backend/pull/2135"},"issue":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/2135"},"comments":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/2135/comments"},"review_comments":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/2135/comments"},"review_comment":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/2135/commits"},"statuses":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/statuses/3cfa419ae582cae82cd30f06f8252672ee0488ff"}}}}