{"action":"created","comment":{"url":"https://api.github.com/repos/boostorg/geometry/pulls/comments/55485856","id":55485856,"diff_hunk":"@@ -61,9 +65,94 @@ struct box_covered_by_range\n };\n \n \n+// spherical_equatorial_tag and spherical_polar_tag is casted to spherical_tag\n+template <typename Geometry>\n+struct box_within_range<Geometry, 0, spherical_tag>\n+{\n+    template <typename BoxContainedValue, typename BoxContainingValue>\n+    static inline bool apply(BoxContainedValue const& bed_min,\n+                             BoxContainedValue const& bed_max,\n+                             BoxContainingValue const& bing_min,\n+                             BoxContainingValue const& bing_max)\n+    {\n+        typedef typename select_most_precise\n+            <\n+                BoxContainedValue,\n+                BoxContainingValue\n+            >::type calc_t;\n+        typedef typename coordinate_system<Geometry>::type::units units_t;\n+        typedef math::detail::constants_on_spheroid<calc_t, units_t> constants;\n+\n+        // min <= max <=> diff >= 0\n+        calc_t const diff_ed = bed_max - bed_min;\n+        calc_t const diff_ing = bing_max - bing_min;\n+        // if containing is smaller it cannot contain\n+        // or interiors doesn't overlap (no interior in contained)\n+        if (diff_ing < diff_ed || diff_ed == 0)\n+            return false;\n+\n+        // if containing covers the whole globe it contains all\n+        if (!math::smaller(diff_ing, constants::period())) // >= period\n+            return true;\n+\n+        // calculate positive longitude translation with bing_min as origin\n+        calc_t const c0 = 0;\n+        calc_t diff_min = bed_min - bing_min;\n+        math::normalize_longitude<units_t, calc_t>(diff_min);\n+        if (diff_min < c0) // [-180, 180] -> [0, 360]\n+            diff_min += constants::period();\n+\n+        return bing_min + diff_min + diff_ed <= bing_max;\n+    }\n+};\n+\n+\n+template <typename Geometry>\n+struct box_covered_by_range<Geometry, 0, spherical_tag>\n+{\n+    template <typename BoxContainedValue, typename BoxContainingValue>\n+    static inline bool apply(BoxContainedValue const& bed_min,\n+                             BoxContainedValue const& bed_max,\n+                             BoxContainingValue const& bing_min,\n+                             BoxContainingValue const& bing_max)","path":"include/boost/geometry/strategies/cartesian/box_in_box.hpp","position":89,"original_position":89,"commit_id":"764aba9ec1852ed82f068c0da1831986f110e0cf","original_commit_id":"764aba9ec1852ed82f068c0da1831986f110e0cf","user":{"login":"barendgehrels","id":334849,"avatar_url":"https://avatars.githubusercontent.com/u/334849?v=3","gravatar_id":"","url":"https://api.github.com/users/barendgehrels","html_url":"https://github.com/barendgehrels","followers_url":"https://api.github.com/users/barendgehrels/followers","following_url":"https://api.github.com/users/barendgehrels/following{/other_user}","gists_url":"https://api.github.com/users/barendgehrels/gists{/gist_id}","starred_url":"https://api.github.com/users/barendgehrels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barendgehrels/subscriptions","organizations_url":"https://api.github.com/users/barendgehrels/orgs","repos_url":"https://api.github.com/users/barendgehrels/repos","events_url":"https://api.github.com/users/barendgehrels/events{/privacy}","received_events_url":"https://api.github.com/users/barendgehrels/received_events","type":"User","site_admin":false},"body":"Sorry, I have no idea what you mean by bed / bing. Can you change the names to something more meaningful?","created_at":"2016-03-09T08:36:11Z","updated_at":"2016-03-09T08:36:11Z","html_url":"https://github.com/boostorg/geometry/pull/345#discussion_r55485856","pull_request_url":"https://api.github.com/repos/boostorg/geometry/pulls/345","_links":{"self":{"href":"https://api.github.com/repos/boostorg/geometry/pulls/comments/55485856"},"html":{"href":"https://github.com/boostorg/geometry/pull/345#discussion_r55485856"},"pull_request":{"href":"https://api.github.com/repos/boostorg/geometry/pulls/345"}}},"pull_request":{"url":"https://api.github.com/repos/boostorg/geometry/pulls/345","id":62179917,"html_url":"https://github.com/boostorg/geometry/pull/345","diff_url":"https://github.com/boostorg/geometry/pull/345.diff","patch_url":"https://github.com/boostorg/geometry/pull/345.patch","issue_url":"https://api.github.com/repos/boostorg/geometry/issues/345","number":345,"state":"open","locked":false,"title":"Point/Box and Box/Box spatial relations in non-cartesian coordinate systems.","user":{"login":"awulkiew","id":1226951,"avatar_url":"https://avatars.githubusercontent.com/u/1226951?v=3","gravatar_id":"","url":"https://api.github.com/users/awulkiew","html_url":"https://github.com/awulkiew","followers_url":"https://api.github.com/users/awulkiew/followers","following_url":"https://api.github.com/users/awulkiew/following{/other_user}","gists_url":"https://api.github.com/users/awulkiew/gists{/gist_id}","starred_url":"https://api.github.com/users/awulkiew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awulkiew/subscriptions","organizations_url":"https://api.github.com/users/awulkiew/orgs","repos_url":"https://api.github.com/users/awulkiew/repos","events_url":"https://api.github.com/users/awulkiew/events{/privacy}","received_events_url":"https://api.github.com/users/awulkiew/received_events","type":"User","site_admin":false},"body":"This PR adds or changes the following:\r\n- support spherical/geographic CS in `box_in_box` strategy and enable it as the default one\r\n- support spherical/geographic CS in `point_in_box` strategy and enable it as the default one\r\n- fix `disjoint()`/`intersects()` for point/box in spherical/geographic CS (using tools implemented for `point_in_box` strategy)\r\n- fix `disjoint()`/`intersects()` for box/box in spherical/geographic CS (separate implementation)\r\n\r\nThis PR changes the way how `within(point, box)` and `covered_by(point, box)` is calculated by default. The reason is that a Box in spherical and geographical CS is not a Polygon. The differences are:\r\n- the horizontal edge of a Box may be longer than 180 deg\r\n- the horizontal edge of a Box is not defined by geodesic but by small circle\r\n\r\n`point_in_box_by_side` is no longer used by default. It returns wrong result for Boxes with edges longer than 180 deg. It's because when a side is calculated the closer direction is picked so for those long edges (length in (180, 360]) some sides are the opposite than expected.\r\n\r\nThis PR also fixes the ticket: https://svn.boost.org/trac/boost/ticket/11987\r\n\r\nSince `point_in_box` and `box_in_box` now support all CSes I plan to move them to `strategies/agnostic` directory. This is not a part of this PR to make the review of the code more convenient, to avoid displaying the unchanged parts of implementations as new ones on GitHub.","created_at":"2016-03-09T04:56:23Z","updated_at":"2016-03-09T08:36:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c3bc8a262ead7cc8efa2d62459f9e336ac73f63","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/boostorg/geometry/pulls/345/commits","review_comments_url":"https://api.github.com/repos/boostorg/geometry/pulls/345/comments","review_comment_url":"https://api.github.com/repos/boostorg/geometry/pulls/comments{/number}","comments_url":"https://api.github.com/repos/boostorg/geometry/issues/345/comments","statuses_url":"https://api.github.com/repos/boostorg/geometry/statuses/764aba9ec1852ed82f068c0da1831986f110e0cf","head":{"label":"awulkiew:feature/xxx_in_box","ref":"feature/xxx_in_box","sha":"764aba9ec1852ed82f068c0da1831986f110e0cf","user":{"login":"awulkiew","id":1226951,"avatar_url":"https://avatars.githubusercontent.com/u/1226951?v=3","gravatar_id":"","url":"https://api.github.com/users/awulkiew","html_url":"https://github.com/awulkiew","followers_url":"https://api.github.com/users/awulkiew/followers","following_url":"https://api.github.com/users/awulkiew/following{/other_user}","gists_url":"https://api.github.com/users/awulkiew/gists{/gist_id}","starred_url":"https://api.github.com/users/awulkiew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awulkiew/subscriptions","organizations_url":"https://api.github.com/users/awulkiew/orgs","repos_url":"https://api.github.com/users/awulkiew/repos","events_url":"https://api.github.com/users/awulkiew/events{/privacy}","received_events_url":"https://api.github.com/users/awulkiew/received_events","type":"User","site_admin":false},"repo":{"id":20000078,"name":"geometry","full_name":"awulkiew/geometry","owner":{"login":"awulkiew","id":1226951,"avatar_url":"https://avatars.githubusercontent.com/u/1226951?v=3","gravatar_id":"","url":"https://api.github.com/users/awulkiew","html_url":"https://github.com/awulkiew","followers_url":"https://api.github.com/users/awulkiew/followers","following_url":"https://api.github.com/users/awulkiew/following{/other_user}","gists_url":"https://api.github.com/users/awulkiew/gists{/gist_id}","starred_url":"https://api.github.com/users/awulkiew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awulkiew/subscriptions","organizations_url":"https://api.github.com/users/awulkiew/orgs","repos_url":"https://api.github.com/users/awulkiew/repos","events_url":"https://api.github.com/users/awulkiew/events{/privacy}","received_events_url":"https://api.github.com/users/awulkiew/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/awulkiew/geometry","description":"Boost.org geometry module","fork":true,"url":"https://api.github.com/repos/awulkiew/geometry","forks_url":"https://api.github.com/repos/awulkiew/geometry/forks","keys_url":"https://api.github.com/repos/awulkiew/geometry/keys{/key_id}","collaborators_url":"https://api.github.com/repos/awulkiew/geometry/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/awulkiew/geometry/teams","hooks_url":"https://api.github.com/repos/awulkiew/geometry/hooks","issue_events_url":"https://api.github.com/repos/awulkiew/geometry/issues/events{/number}","events_url":"https://api.github.com/repos/awulkiew/geometry/events","assignees_url":"https://api.github.com/repos/awulkiew/geometry/assignees{/user}","branches_url":"https://api.github.com/repos/awulkiew/geometry/branches{/branch}","tags_url":"https://api.github.com/repos/awulkiew/geometry/tags","blobs_url":"https://api.github.com/repos/awulkiew/geometry/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/awulkiew/geometry/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/awulkiew/geometry/git/refs{/sha}","trees_url":"https://api.github.com/repos/awulkiew/geometry/git/trees{/sha}","statuses_url":"https://api.github.com/repos/awulkiew/geometry/statuses/{sha}","languages_url":"https://api.github.com/repos/awulkiew/geometry/languages","stargazers_url":"https://api.github.com/repos/awulkiew/geometry/stargazers","contributors_url":"https://api.github.com/repos/awulkiew/geometry/contributors","subscribers_url":"https://api.github.com/repos/awulkiew/geometry/subscribers","subscription_url":"https://api.github.com/repos/awulkiew/geometry/subscription","commits_url":"https://api.github.com/repos/awulkiew/geometry/commits{/sha}","git_commits_url":"https://api.github.com/repos/awulkiew/geometry/git/commits{/sha}","comments_url":"https://api.github.com/repos/awulkiew/geometry/comments{/number}","issue_comment_url":"https://api.github.com/repos/awulkiew/geometry/issues/comments{/number}","contents_url":"https://api.github.com/repos/awulkiew/geometry/contents/{+path}","compare_url":"https://api.github.com/repos/awulkiew/geometry/compare/{base}...{head}","merges_url":"https://api.github.com/repos/awulkiew/geometry/merges","archive_url":"https://api.github.com/repos/awulkiew/geometry/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/awulkiew/geometry/downloads","issues_url":"https://api.github.com/repos/awulkiew/geometry/issues{/number}","pulls_url":"https://api.github.com/repos/awulkiew/geometry/pulls{/number}","milestones_url":"https://api.github.com/repos/awulkiew/geometry/milestones{/number}","notifications_url":"https://api.github.com/repos/awulkiew/geometry/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/awulkiew/geometry/labels{/name}","releases_url":"https://api.github.com/repos/awulkiew/geometry/releases{/id}","deployments_url":"https://api.github.com/repos/awulkiew/geometry/deployments","created_at":"2014-05-20T22:38:29Z","updated_at":"2016-03-06T04:39:54Z","pushed_at":"2016-03-09T04:35:13Z","git_url":"git://github.com/awulkiew/geometry.git","ssh_url":"git@github.com:awulkiew/geometry.git","clone_url":"https://github.com/awulkiew/geometry.git","svn_url":"https://github.com/awulkiew/geometry","homepage":"http://boost.org/libs/geometry","size":37185,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"base":{"label":"boostorg:develop","ref":"develop","sha":"183d32f2e3953286474662b9152cd6622bb83219","user":{"login":"boostorg","id":3170529,"avatar_url":"https://avatars.githubusercontent.com/u/3170529?v=3","gravatar_id":"","url":"https://api.github.com/users/boostorg","html_url":"https://github.com/boostorg","followers_url":"https://api.github.com/users/boostorg/followers","following_url":"https://api.github.com/users/boostorg/following{/other_user}","gists_url":"https://api.github.com/users/boostorg/gists{/gist_id}","starred_url":"https://api.github.com/users/boostorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boostorg/subscriptions","organizations_url":"https://api.github.com/users/boostorg/orgs","repos_url":"https://api.github.com/users/boostorg/repos","events_url":"https://api.github.com/users/boostorg/events{/privacy}","received_events_url":"https://api.github.com/users/boostorg/received_events","type":"Organization","site_admin":false},"repo":{"id":7590021,"name":"geometry","full_name":"boostorg/geometry","owner":{"login":"boostorg","id":3170529,"avatar_url":"https://avatars.githubusercontent.com/u/3170529?v=3","gravatar_id":"","url":"https://api.github.com/users/boostorg","html_url":"https://github.com/boostorg","followers_url":"https://api.github.com/users/boostorg/followers","following_url":"https://api.github.com/users/boostorg/following{/other_user}","gists_url":"https://api.github.com/users/boostorg/gists{/gist_id}","starred_url":"https://api.github.com/users/boostorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boostorg/subscriptions","organizations_url":"https://api.github.com/users/boostorg/orgs","repos_url":"https://api.github.com/users/boostorg/repos","events_url":"https://api.github.com/users/boostorg/events{/privacy}","received_events_url":"https://api.github.com/users/boostorg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/boostorg/geometry","description":"Boost.org geometry module","fork":false,"url":"https://api.github.com/repos/boostorg/geometry","forks_url":"https://api.github.com/repos/boostorg/geometry/forks","keys_url":"https://api.github.com/repos/boostorg/geometry/keys{/key_id}","collaborators_url":"https://api.github.com/repos/boostorg/geometry/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/boostorg/geometry/teams","hooks_url":"https://api.github.com/repos/boostorg/geometry/hooks","issue_events_url":"https://api.github.com/repos/boostorg/geometry/issues/events{/number}","events_url":"https://api.github.com/repos/boostorg/geometry/events","assignees_url":"https://api.github.com/repos/boostorg/geometry/assignees{/user}","branches_url":"https://api.github.com/repos/boostorg/geometry/branches{/branch}","tags_url":"https://api.github.com/repos/boostorg/geometry/tags","blobs_url":"https://api.github.com/repos/boostorg/geometry/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/boostorg/geometry/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/boostorg/geometry/git/refs{/sha}","trees_url":"https://api.github.com/repos/boostorg/geometry/git/trees{/sha}","statuses_url":"https://api.github.com/repos/boostorg/geometry/statuses/{sha}","languages_url":"https://api.github.com/repos/boostorg/geometry/languages","stargazers_url":"https://api.github.com/repos/boostorg/geometry/stargazers","contributors_url":"https://api.github.com/repos/boostorg/geometry/contributors","subscribers_url":"https://api.github.com/repos/boostorg/geometry/subscribers","subscription_url":"https://api.github.com/repos/boostorg/geometry/subscription","commits_url":"https://api.github.com/repos/boostorg/geometry/commits{/sha}","git_commits_url":"https://api.github.com/repos/boostorg/geometry/git/commits{/sha}","comments_url":"https://api.github.com/repos/boostorg/geometry/comments{/number}","issue_comment_url":"https://api.github.com/repos/boostorg/geometry/issues/comments{/number}","contents_url":"https://api.github.com/repos/boostorg/geometry/contents/{+path}","compare_url":"https://api.github.com/repos/boostorg/geometry/compare/{base}...{head}","merges_url":"https://api.github.com/repos/boostorg/geometry/merges","archive_url":"https://api.github.com/repos/boostorg/geometry/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/boostorg/geometry/downloads","issues_url":"https://api.github.com/repos/boostorg/geometry/issues{/number}","pulls_url":"https://api.github.com/repos/boostorg/geometry/pulls{/number}","milestones_url":"https://api.github.com/repos/boostorg/geometry/milestones{/number}","notifications_url":"https://api.github.com/repos/boostorg/geometry/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/boostorg/geometry/labels{/name}","releases_url":"https://api.github.com/repos/boostorg/geometry/releases{/id}","deployments_url":"https://api.github.com/repos/boostorg/geometry/deployments","created_at":"2013-01-13T15:59:29Z","updated_at":"2016-03-02T01:08:40Z","pushed_at":"2016-03-09T04:56:23Z","git_url":"git://github.com/boostorg/geometry.git","ssh_url":"git@github.com:boostorg/geometry.git","clone_url":"https://github.com/boostorg/geometry.git","svn_url":"https://github.com/boostorg/geometry","homepage":"http://boost.org/libs/geometry","size":37597,"stargazers_count":69,"watchers_count":69,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":54,"mirror_url":null,"open_issues_count":5,"forks":54,"open_issues":5,"watchers":69,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/boostorg/geometry/pulls/345"},"html":{"href":"https://github.com/boostorg/geometry/pull/345"},"issue":{"href":"https://api.github.com/repos/boostorg/geometry/issues/345"},"comments":{"href":"https://api.github.com/repos/boostorg/geometry/issues/345/comments"},"review_comments":{"href":"https://api.github.com/repos/boostorg/geometry/pulls/345/comments"},"review_comment":{"href":"https://api.github.com/repos/boostorg/geometry/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/boostorg/geometry/pulls/345/commits"},"statuses":{"href":"https://api.github.com/repos/boostorg/geometry/statuses/764aba9ec1852ed82f068c0da1831986f110e0cf"}}}}