{"action":"created","comment":{"url":"https://api.github.com/repos/georust/rust-geo/pulls/comments/71179085","id":71179085,"diff_hunk":"@@ -0,0 +1,205 @@\n+use num::Float;\n+\n+use types::{Bbox, Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon};\n+\n+/// Calculation of the bounding box of a geometry.\n+\n+pub trait BoundingBox<T: Float> {\n+    /// Return a Bounding Box of a geometry\n+    ///\n+    /// ```\n+    /// use geo::{Point, LineString, Coordinate};\n+    /// use geo::algorithm::boundingbox::BoundingBox;\n+    ///\n+    /// let mut vec = Vec::new();\n+    /// vec.push(Point::new(40.02f64, 116.34));\n+    /// vec.push(Point::new(42.02f64, 116.34));\n+    /// vec.push(Point::new(42.02f64, 118.34));\n+    /// let linestring = LineString(vec);\n+    /// let bbox = linestring.bbox().unwrap();\n+    ///\n+    /// println!(\"Bbox top left coordinates: {}, {}\", bbox.xmin, bbox.ymax);\n+    /// println!(\"Bbox bottom right coordinates: {}, {}\", bbox.xmax, bbox.ymin);\n+    /// ```\n+    ///\n+    fn bbox(&self) -> Option<Bbox<T>>;\n+}\n+\n+\n+fn get_min_max<T>(p: T, min: T, max: T) -> (T, T)\n+    where T: Float\n+{\n+    if p > max {(min, p)} else if p < min {(p, max)} else {(min, max)}\n+}\n+\n+fn get_bbox<T>(vect: &Vec<Point<T>>) -> Option<Bbox<T>>\n+    where T: Float\n+{\n+    if vect.is_empty() {\n+        return None;","path":"src/algorithm/boundingbox.rs","position":39,"original_position":39,"commit_id":"ab6101122a9220dca86d215d337e64abf4eea5f8","original_commit_id":"ab6101122a9220dca86d215d337e64abf4eea5f8","user":{"login":"TeXitoi","id":5787066,"avatar_url":"https://avatars.githubusercontent.com/u/5787066?v=3","gravatar_id":"","url":"https://api.github.com/users/TeXitoi","html_url":"https://github.com/TeXitoi","followers_url":"https://api.github.com/users/TeXitoi/followers","following_url":"https://api.github.com/users/TeXitoi/following{/other_user}","gists_url":"https://api.github.com/users/TeXitoi/gists{/gist_id}","starred_url":"https://api.github.com/users/TeXitoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TeXitoi/subscriptions","organizations_url":"https://api.github.com/users/TeXitoi/orgs","repos_url":"https://api.github.com/users/TeXitoi/repos","events_url":"https://api.github.com/users/TeXitoi/events{/privacy}","received_events_url":"https://api.github.com/users/TeXitoi/received_events","type":"User","site_admin":false},"body":"OK for me.","created_at":"2016-07-18T16:20:15Z","updated_at":"2016-07-18T16:20:15Z","html_url":"https://github.com/georust/rust-geo/pull/41#discussion_r71179085","pull_request_url":"https://api.github.com/repos/georust/rust-geo/pulls/41","_links":{"self":{"href":"https://api.github.com/repos/georust/rust-geo/pulls/comments/71179085"},"html":{"href":"https://github.com/georust/rust-geo/pull/41#discussion_r71179085"},"pull_request":{"href":"https://api.github.com/repos/georust/rust-geo/pulls/41"}}},"pull_request":{"url":"https://api.github.com/repos/georust/rust-geo/pulls/41","id":77733515,"html_url":"https://github.com/georust/rust-geo/pull/41","diff_url":"https://github.com/georust/rust-geo/pull/41.diff","patch_url":"https://github.com/georust/rust-geo/pull/41.patch","issue_url":"https://api.github.com/repos/georust/rust-geo/issues/41","number":41,"state":"open","locked":false,"title":"Add type Bbox and trait BoundingBox","user":{"login":"zarch","id":69789,"avatar_url":"https://avatars.githubusercontent.com/u/69789?v=3","gravatar_id":"","url":"https://api.github.com/users/zarch","html_url":"https://github.com/zarch","followers_url":"https://api.github.com/users/zarch/followers","following_url":"https://api.github.com/users/zarch/following{/other_user}","gists_url":"https://api.github.com/users/zarch/gists{/gist_id}","starred_url":"https://api.github.com/users/zarch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zarch/subscriptions","organizations_url":"https://api.github.com/users/zarch/orgs","repos_url":"https://api.github.com/users/zarch/repos","events_url":"https://api.github.com/users/zarch/events{/privacy}","received_events_url":"https://api.github.com/users/zarch/received_events","type":"User","site_admin":false},"body":"I'm not sure that it is right to add the BoundingBox at the rust-geo project, since the boundingbox is not a geometry, but on the other hand it seems a sort of characteristic of the geometry.\r\n\r\nWhat do you think?\r\n\r\nConcerning the implementation I don't like too much how the trait BoundingBox is implemented (see: src/algorithm/boundingbox.rs) for MultiLineString and MultiPolygon, because the code is duplicated. I would like to move the code into a private function and call this function from the method, but I was not able to say at the function to take a parameter that can accept only MultiLineString or MultiPolygon. Any ideas on how I can implement this?\r\n\r\nDo you see other improvements? ","created_at":"2016-07-17T11:50:04Z","updated_at":"2016-07-18T16:20:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1908d97cadf25eb92135d5e0193c08ce9d00a1d5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/georust/rust-geo/pulls/41/commits","review_comments_url":"https://api.github.com/repos/georust/rust-geo/pulls/41/comments","review_comment_url":"https://api.github.com/repos/georust/rust-geo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/georust/rust-geo/issues/41/comments","statuses_url":"https://api.github.com/repos/georust/rust-geo/statuses/ab6101122a9220dca86d215d337e64abf4eea5f8","head":{"label":"zarch:bbox","ref":"bbox","sha":"ab6101122a9220dca86d215d337e64abf4eea5f8","user":{"login":"zarch","id":69789,"avatar_url":"https://avatars.githubusercontent.com/u/69789?v=3","gravatar_id":"","url":"https://api.github.com/users/zarch","html_url":"https://github.com/zarch","followers_url":"https://api.github.com/users/zarch/followers","following_url":"https://api.github.com/users/zarch/following{/other_user}","gists_url":"https://api.github.com/users/zarch/gists{/gist_id}","starred_url":"https://api.github.com/users/zarch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zarch/subscriptions","organizations_url":"https://api.github.com/users/zarch/orgs","repos_url":"https://api.github.com/users/zarch/repos","events_url":"https://api.github.com/users/zarch/events{/privacy}","received_events_url":"https://api.github.com/users/zarch/received_events","type":"User","site_admin":false},"repo":{"id":58656795,"name":"rust-geo","full_name":"zarch/rust-geo","owner":{"login":"zarch","id":69789,"avatar_url":"https://avatars.githubusercontent.com/u/69789?v=3","gravatar_id":"","url":"https://api.github.com/users/zarch","html_url":"https://github.com/zarch","followers_url":"https://api.github.com/users/zarch/followers","following_url":"https://api.github.com/users/zarch/following{/other_user}","gists_url":"https://api.github.com/users/zarch/gists{/gist_id}","starred_url":"https://api.github.com/users/zarch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zarch/subscriptions","organizations_url":"https://api.github.com/users/zarch/orgs","repos_url":"https://api.github.com/users/zarch/repos","events_url":"https://api.github.com/users/zarch/events{/privacy}","received_events_url":"https://api.github.com/users/zarch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zarch/rust-geo","description":"Simple geospatial primitives for Rust","fork":true,"url":"https://api.github.com/repos/zarch/rust-geo","forks_url":"https://api.github.com/repos/zarch/rust-geo/forks","keys_url":"https://api.github.com/repos/zarch/rust-geo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zarch/rust-geo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zarch/rust-geo/teams","hooks_url":"https://api.github.com/repos/zarch/rust-geo/hooks","issue_events_url":"https://api.github.com/repos/zarch/rust-geo/issues/events{/number}","events_url":"https://api.github.com/repos/zarch/rust-geo/events","assignees_url":"https://api.github.com/repos/zarch/rust-geo/assignees{/user}","branches_url":"https://api.github.com/repos/zarch/rust-geo/branches{/branch}","tags_url":"https://api.github.com/repos/zarch/rust-geo/tags","blobs_url":"https://api.github.com/repos/zarch/rust-geo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zarch/rust-geo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zarch/rust-geo/git/refs{/sha}","trees_url":"https://api.github.com/repos/zarch/rust-geo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zarch/rust-geo/statuses/{sha}","languages_url":"https://api.github.com/repos/zarch/rust-geo/languages","stargazers_url":"https://api.github.com/repos/zarch/rust-geo/stargazers","contributors_url":"https://api.github.com/repos/zarch/rust-geo/contributors","subscribers_url":"https://api.github.com/repos/zarch/rust-geo/subscribers","subscription_url":"https://api.github.com/repos/zarch/rust-geo/subscription","commits_url":"https://api.github.com/repos/zarch/rust-geo/commits{/sha}","git_commits_url":"https://api.github.com/repos/zarch/rust-geo/git/commits{/sha}","comments_url":"https://api.github.com/repos/zarch/rust-geo/comments{/number}","issue_comment_url":"https://api.github.com/repos/zarch/rust-geo/issues/comments{/number}","contents_url":"https://api.github.com/repos/zarch/rust-geo/contents/{+path}","compare_url":"https://api.github.com/repos/zarch/rust-geo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zarch/rust-geo/merges","archive_url":"https://api.github.com/repos/zarch/rust-geo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zarch/rust-geo/downloads","issues_url":"https://api.github.com/repos/zarch/rust-geo/issues{/number}","pulls_url":"https://api.github.com/repos/zarch/rust-geo/pulls{/number}","milestones_url":"https://api.github.com/repos/zarch/rust-geo/milestones{/number}","notifications_url":"https://api.github.com/repos/zarch/rust-geo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zarch/rust-geo/labels{/name}","releases_url":"https://api.github.com/repos/zarch/rust-geo/releases{/id}","deployments_url":"https://api.github.com/repos/zarch/rust-geo/deployments","created_at":"2016-05-12T16:06:18Z","updated_at":"2016-05-12T16:06:19Z","pushed_at":"2016-07-18T16:06:08Z","git_url":"git://github.com/zarch/rust-geo.git","ssh_url":"git@github.com:zarch/rust-geo.git","clone_url":"https://github.com/zarch/rust-geo.git","svn_url":"https://github.com/zarch/rust-geo","homepage":"https://crates.io/crates/geo","size":660,"stargazers_count":0,"watchers_count":0,"language":"Rust","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":0,"default_branch":"master"}},"base":{"label":"georust:master","ref":"master","sha":"8369162ccc7431c3584d68ae18a5e18387556bae","user":{"login":"georust","id":10320338,"avatar_url":"https://avatars.githubusercontent.com/u/10320338?v=3","gravatar_id":"","url":"https://api.github.com/users/georust","html_url":"https://github.com/georust","followers_url":"https://api.github.com/users/georust/followers","following_url":"https://api.github.com/users/georust/following{/other_user}","gists_url":"https://api.github.com/users/georust/gists{/gist_id}","starred_url":"https://api.github.com/users/georust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georust/subscriptions","organizations_url":"https://api.github.com/users/georust/orgs","repos_url":"https://api.github.com/users/georust/repos","events_url":"https://api.github.com/users/georust/events{/privacy}","received_events_url":"https://api.github.com/users/georust/received_events","type":"Organization","site_admin":false},"repo":{"id":29326047,"name":"rust-geo","full_name":"georust/rust-geo","owner":{"login":"georust","id":10320338,"avatar_url":"https://avatars.githubusercontent.com/u/10320338?v=3","gravatar_id":"","url":"https://api.github.com/users/georust","html_url":"https://github.com/georust","followers_url":"https://api.github.com/users/georust/followers","following_url":"https://api.github.com/users/georust/following{/other_user}","gists_url":"https://api.github.com/users/georust/gists{/gist_id}","starred_url":"https://api.github.com/users/georust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georust/subscriptions","organizations_url":"https://api.github.com/users/georust/orgs","repos_url":"https://api.github.com/users/georust/repos","events_url":"https://api.github.com/users/georust/events{/privacy}","received_events_url":"https://api.github.com/users/georust/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/georust/rust-geo","description":"Geospatial primitives and algorithms for Rust","fork":false,"url":"https://api.github.com/repos/georust/rust-geo","forks_url":"https://api.github.com/repos/georust/rust-geo/forks","keys_url":"https://api.github.com/repos/georust/rust-geo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/georust/rust-geo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/georust/rust-geo/teams","hooks_url":"https://api.github.com/repos/georust/rust-geo/hooks","issue_events_url":"https://api.github.com/repos/georust/rust-geo/issues/events{/number}","events_url":"https://api.github.com/repos/georust/rust-geo/events","assignees_url":"https://api.github.com/repos/georust/rust-geo/assignees{/user}","branches_url":"https://api.github.com/repos/georust/rust-geo/branches{/branch}","tags_url":"https://api.github.com/repos/georust/rust-geo/tags","blobs_url":"https://api.github.com/repos/georust/rust-geo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/georust/rust-geo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/georust/rust-geo/git/refs{/sha}","trees_url":"https://api.github.com/repos/georust/rust-geo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/georust/rust-geo/statuses/{sha}","languages_url":"https://api.github.com/repos/georust/rust-geo/languages","stargazers_url":"https://api.github.com/repos/georust/rust-geo/stargazers","contributors_url":"https://api.github.com/repos/georust/rust-geo/contributors","subscribers_url":"https://api.github.com/repos/georust/rust-geo/subscribers","subscription_url":"https://api.github.com/repos/georust/rust-geo/subscription","commits_url":"https://api.github.com/repos/georust/rust-geo/commits{/sha}","git_commits_url":"https://api.github.com/repos/georust/rust-geo/git/commits{/sha}","comments_url":"https://api.github.com/repos/georust/rust-geo/comments{/number}","issue_comment_url":"https://api.github.com/repos/georust/rust-geo/issues/comments{/number}","contents_url":"https://api.github.com/repos/georust/rust-geo/contents/{+path}","compare_url":"https://api.github.com/repos/georust/rust-geo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/georust/rust-geo/merges","archive_url":"https://api.github.com/repos/georust/rust-geo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/georust/rust-geo/downloads","issues_url":"https://api.github.com/repos/georust/rust-geo/issues{/number}","pulls_url":"https://api.github.com/repos/georust/rust-geo/pulls{/number}","milestones_url":"https://api.github.com/repos/georust/rust-geo/milestones{/number}","notifications_url":"https://api.github.com/repos/georust/rust-geo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/georust/rust-geo/labels{/name}","releases_url":"https://api.github.com/repos/georust/rust-geo/releases{/id}","deployments_url":"https://api.github.com/repos/georust/rust-geo/deployments","created_at":"2015-01-16T01:00:41Z","updated_at":"2016-07-18T14:42:08Z","pushed_at":"2016-07-18T16:06:09Z","git_url":"git://github.com/georust/rust-geo.git","ssh_url":"git@github.com:georust/rust-geo.git","clone_url":"https://github.com/georust/rust-geo.git","svn_url":"https://github.com/georust/rust-geo","homepage":"https://crates.io/crates/geo","size":2235,"stargazers_count":33,"watchers_count":33,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":12,"forks":9,"open_issues":12,"watchers":33,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/georust/rust-geo/pulls/41"},"html":{"href":"https://github.com/georust/rust-geo/pull/41"},"issue":{"href":"https://api.github.com/repos/georust/rust-geo/issues/41"},"comments":{"href":"https://api.github.com/repos/georust/rust-geo/issues/41/comments"},"review_comments":{"href":"https://api.github.com/repos/georust/rust-geo/pulls/41/comments"},"review_comment":{"href":"https://api.github.com/repos/georust/rust-geo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/georust/rust-geo/pulls/41/commits"},"statuses":{"href":"https://api.github.com/repos/georust/rust-geo/statuses/ab6101122a9220dca86d215d337e64abf4eea5f8"}}}}
{"actor":{"display_login":"TeXitoi"}}