{"action":"created","comment":{"url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments/84047872","pull_request_review_id":4849191,"id":84047872,"diff_hunk":"@@ -0,0 +1,111 @@\n+/*\n+ * Copyright 2016 The Cartographer Authors\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+#include \"cartographer/io/ply_writing_points_processor.h\"\n+\n+#include <iomanip>\n+\n+#include \"glog/logging.h\"\n+\n+namespace cartographer {\n+namespace io {\n+\n+namespace {\n+\n+// Writes the PLY header claiming 'num_points' will follow it into\n+// 'output_file'.\n+void WriteBinaryPlyHeader(const bool has_color, const int64 num_points,\n+                          std::ofstream* stream) {\n+  string color_header = !has_color ? \"\" : \"property uchar red\\n\"\n+                                          \"property uchar green\\n\"\n+                                          \"property uchar blue\\n\";\n+\n+  (*stream) << \"ply\\n\"\n+            << \"format binary_little_endian 1.0\\n\"\n+            << \"comment generated by Cartographer\\n\"\n+            << \"element vertex \" << std::setw(15) << std::setfill('0')\n+            << num_points << \"\\n\"\n+            << \"property float x\\n\"\n+            << \"property float y\\n\"\n+            << \"property float z\\n\"\n+            << color_header << \"end_header\\n\";\n+}\n+\n+void WriteBinaryPlyPointCoordinate(const Eigen::Vector3f& point,\n+                                   std::ofstream* stream) {\n+  char buffer[12];\n+  memcpy(buffer, &point[0], sizeof(float));\n+  memcpy(buffer + 4, &point[1], sizeof(float));\n+  memcpy(buffer + 8, &point[2], sizeof(float));\n+  for (int i = 0; i < 12; ++i) {\n+    stream->put(buffer[i]);\n+  }\n+}\n+\n+void WriteBinaryPlyPointColor(const Color& color, std::ostream* stream) {\n+  stream->put(color[0]);\n+  stream->put(color[1]);\n+  stream->put(color[2]);\n+}\n+\n+}  // namespace\n+\n+PlyWritingPointsProcessor::PlyWritingPointsProcessor(const string& filename,\n+                                                     PointsProcessor* next)\n+    : next_(next),\n+      num_points_(0),\n+      has_colors_(false),\n+      file_(filename, std::ios_base::out | std::ios_base::binary) {}\n+\n+PointsProcessor::FlushResult PlyWritingPointsProcessor::Flush() {\n+  file_.flush();\n+  file_.seekp(0);\n+\n+  WriteBinaryPlyHeader(has_colors_, num_points_, &file_);\n+  file_.flush();\n+\n+  switch (next_->Flush()) {\n+    case FlushResult::kFinished:\n+      return FlushResult::kFinished;\n+\n+    case FlushResult::kRestartStream:\n+      LOG(FATAL) << \"Not supported\";","path":"cartographer/io/ply_writing_points_processor.cc","position":85,"original_position":85,"commit_id":"72266c4dbf7a42a276ac6c1a5c37d0100a4584a8","original_commit_id":"72266c4dbf7a42a276ac6c1a5c37d0100a4584a8","user":{"login":"damonkohler","id":191389,"avatar_url":"https://avatars.githubusercontent.com/u/191389?v=3","gravatar_id":"","url":"https://api.github.com/users/damonkohler","html_url":"https://github.com/damonkohler","followers_url":"https://api.github.com/users/damonkohler/followers","following_url":"https://api.github.com/users/damonkohler/following{/other_user}","gists_url":"https://api.github.com/users/damonkohler/gists{/gist_id}","starred_url":"https://api.github.com/users/damonkohler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damonkohler/subscriptions","organizations_url":"https://api.github.com/users/damonkohler/orgs","repos_url":"https://api.github.com/users/damonkohler/repos","events_url":"https://api.github.com/users/damonkohler/events{/privacy}","received_events_url":"https://api.github.com/users/damonkohler/received_events","type":"User","site_admin":false},"body":"Same as with X-ray. ","created_at":"2016-10-19T11:21:16Z","updated_at":"2016-10-19T11:21:16Z","html_url":"https://github.com/googlecartographer/cartographer/pull/80#discussion_r84047872","pull_request_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/80","_links":{"self":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments/84047872"},"html":{"href":"https://github.com/googlecartographer/cartographer/pull/80#discussion_r84047872"},"pull_request":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/80"}}},"pull_request":{"url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/80","id":89988749,"html_url":"https://github.com/googlecartographer/cartographer/pull/80","diff_url":"https://github.com/googlecartographer/cartographer/pull/80.diff","patch_url":"https://github.com/googlecartographer/cartographer/pull/80.patch","issue_url":"https://api.github.com/repos/googlecartographer/cartographer/issues/80","number":80,"state":"open","locked":false,"title":"Adds a PLY writing points processor.","user":{"login":"SirVer","id":140115,"avatar_url":"https://avatars.githubusercontent.com/u/140115?v=3","gravatar_id":"","url":"https://api.github.com/users/SirVer","html_url":"https://github.com/SirVer","followers_url":"https://api.github.com/users/SirVer/followers","following_url":"https://api.github.com/users/SirVer/following{/other_user}","gists_url":"https://api.github.com/users/SirVer/gists{/gist_id}","starred_url":"https://api.github.com/users/SirVer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SirVer/subscriptions","organizations_url":"https://api.github.com/users/SirVer/orgs","repos_url":"https://api.github.com/users/SirVer/repos","events_url":"https://api.github.com/users/SirVer/events{/privacy}","received_events_url":"https://api.github.com/users/SirVer/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-19T11:17:54Z","updated_at":"2016-10-19T11:22:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a4791a8d6f58353e3890b5c48ec939d951d6506b","assignee":{"login":"damonkohler","id":191389,"avatar_url":"https://avatars.githubusercontent.com/u/191389?v=3","gravatar_id":"","url":"https://api.github.com/users/damonkohler","html_url":"https://github.com/damonkohler","followers_url":"https://api.github.com/users/damonkohler/followers","following_url":"https://api.github.com/users/damonkohler/following{/other_user}","gists_url":"https://api.github.com/users/damonkohler/gists{/gist_id}","starred_url":"https://api.github.com/users/damonkohler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damonkohler/subscriptions","organizations_url":"https://api.github.com/users/damonkohler/orgs","repos_url":"https://api.github.com/users/damonkohler/repos","events_url":"https://api.github.com/users/damonkohler/events{/privacy}","received_events_url":"https://api.github.com/users/damonkohler/received_events","type":"User","site_admin":false},"assignees":[{"login":"damonkohler","id":191389,"avatar_url":"https://avatars.githubusercontent.com/u/191389?v=3","gravatar_id":"","url":"https://api.github.com/users/damonkohler","html_url":"https://github.com/damonkohler","followers_url":"https://api.github.com/users/damonkohler/followers","following_url":"https://api.github.com/users/damonkohler/following{/other_user}","gists_url":"https://api.github.com/users/damonkohler/gists{/gist_id}","starred_url":"https://api.github.com/users/damonkohler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damonkohler/subscriptions","organizations_url":"https://api.github.com/users/damonkohler/orgs","repos_url":"https://api.github.com/users/damonkohler/repos","events_url":"https://api.github.com/users/damonkohler/events{/privacy}","received_events_url":"https://api.github.com/users/damonkohler/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/80/commits","review_comments_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/80/comments","review_comment_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/googlecartographer/cartographer/issues/80/comments","statuses_url":"https://api.github.com/repos/googlecartographer/cartographer/statuses/72266c4dbf7a42a276ac6c1a5c37d0100a4584a8","head":{"label":"SirVer:01_ply_points_processor","ref":"01_ply_points_processor","sha":"72266c4dbf7a42a276ac6c1a5c37d0100a4584a8","user":{"login":"SirVer","id":140115,"avatar_url":"https://avatars.githubusercontent.com/u/140115?v=3","gravatar_id":"","url":"https://api.github.com/users/SirVer","html_url":"https://github.com/SirVer","followers_url":"https://api.github.com/users/SirVer/followers","following_url":"https://api.github.com/users/SirVer/following{/other_user}","gists_url":"https://api.github.com/users/SirVer/gists{/gist_id}","starred_url":"https://api.github.com/users/SirVer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SirVer/subscriptions","organizations_url":"https://api.github.com/users/SirVer/orgs","repos_url":"https://api.github.com/users/SirVer/repos","events_url":"https://api.github.com/users/SirVer/events{/privacy}","received_events_url":"https://api.github.com/users/SirVer/received_events","type":"User","site_admin":false},"repo":{"id":70589927,"name":"cartographer","full_name":"SirVer/cartographer","owner":{"login":"SirVer","id":140115,"avatar_url":"https://avatars.githubusercontent.com/u/140115?v=3","gravatar_id":"","url":"https://api.github.com/users/SirVer","html_url":"https://github.com/SirVer","followers_url":"https://api.github.com/users/SirVer/followers","following_url":"https://api.github.com/users/SirVer/following{/other_user}","gists_url":"https://api.github.com/users/SirVer/gists{/gist_id}","starred_url":"https://api.github.com/users/SirVer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SirVer/subscriptions","organizations_url":"https://api.github.com/users/SirVer/orgs","repos_url":"https://api.github.com/users/SirVer/repos","events_url":"https://api.github.com/users/SirVer/events{/privacy}","received_events_url":"https://api.github.com/users/SirVer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SirVer/cartographer","description":"Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.","fork":true,"url":"https://api.github.com/repos/SirVer/cartographer","forks_url":"https://api.github.com/repos/SirVer/cartographer/forks","keys_url":"https://api.github.com/repos/SirVer/cartographer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SirVer/cartographer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SirVer/cartographer/teams","hooks_url":"https://api.github.com/repos/SirVer/cartographer/hooks","issue_events_url":"https://api.github.com/repos/SirVer/cartographer/issues/events{/number}","events_url":"https://api.github.com/repos/SirVer/cartographer/events","assignees_url":"https://api.github.com/repos/SirVer/cartographer/assignees{/user}","branches_url":"https://api.github.com/repos/SirVer/cartographer/branches{/branch}","tags_url":"https://api.github.com/repos/SirVer/cartographer/tags","blobs_url":"https://api.github.com/repos/SirVer/cartographer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SirVer/cartographer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SirVer/cartographer/git/refs{/sha}","trees_url":"https://api.github.com/repos/SirVer/cartographer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SirVer/cartographer/statuses/{sha}","languages_url":"https://api.github.com/repos/SirVer/cartographer/languages","stargazers_url":"https://api.github.com/repos/SirVer/cartographer/stargazers","contributors_url":"https://api.github.com/repos/SirVer/cartographer/contributors","subscribers_url":"https://api.github.com/repos/SirVer/cartographer/subscribers","subscription_url":"https://api.github.com/repos/SirVer/cartographer/subscription","commits_url":"https://api.github.com/repos/SirVer/cartographer/commits{/sha}","git_commits_url":"https://api.github.com/repos/SirVer/cartographer/git/commits{/sha}","comments_url":"https://api.github.com/repos/SirVer/cartographer/comments{/number}","issue_comment_url":"https://api.github.com/repos/SirVer/cartographer/issues/comments{/number}","contents_url":"https://api.github.com/repos/SirVer/cartographer/contents/{+path}","compare_url":"https://api.github.com/repos/SirVer/cartographer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SirVer/cartographer/merges","archive_url":"https://api.github.com/repos/SirVer/cartographer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SirVer/cartographer/downloads","issues_url":"https://api.github.com/repos/SirVer/cartographer/issues{/number}","pulls_url":"https://api.github.com/repos/SirVer/cartographer/pulls{/number}","milestones_url":"https://api.github.com/repos/SirVer/cartographer/milestones{/number}","notifications_url":"https://api.github.com/repos/SirVer/cartographer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SirVer/cartographer/labels{/name}","releases_url":"https://api.github.com/repos/SirVer/cartographer/releases{/id}","deployments_url":"https://api.github.com/repos/SirVer/cartographer/deployments","created_at":"2016-10-11T12:15:11Z","updated_at":"2016-10-11T12:15:12Z","pushed_at":"2016-10-19T11:17:48Z","git_url":"git://github.com/SirVer/cartographer.git","ssh_url":"git@github.com:SirVer/cartographer.git","clone_url":"https://github.com/SirVer/cartographer.git","svn_url":"https://github.com/SirVer/cartographer","homepage":"","size":443,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":false,"has_wiki":false,"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":"googlecartographer:master","ref":"master","sha":"4a9116a58ec616b09bc154319939b7ce98d7d91a","user":{"login":"googlecartographer","id":20636162,"avatar_url":"https://avatars.githubusercontent.com/u/20636162?v=3","gravatar_id":"","url":"https://api.github.com/users/googlecartographer","html_url":"https://github.com/googlecartographer","followers_url":"https://api.github.com/users/googlecartographer/followers","following_url":"https://api.github.com/users/googlecartographer/following{/other_user}","gists_url":"https://api.github.com/users/googlecartographer/gists{/gist_id}","starred_url":"https://api.github.com/users/googlecartographer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlecartographer/subscriptions","organizations_url":"https://api.github.com/users/googlecartographer/orgs","repos_url":"https://api.github.com/users/googlecartographer/repos","events_url":"https://api.github.com/users/googlecartographer/events{/privacy}","received_events_url":"https://api.github.com/users/googlecartographer/received_events","type":"Organization","site_admin":false},"repo":{"id":64732358,"name":"cartographer","full_name":"googlecartographer/cartographer","owner":{"login":"googlecartographer","id":20636162,"avatar_url":"https://avatars.githubusercontent.com/u/20636162?v=3","gravatar_id":"","url":"https://api.github.com/users/googlecartographer","html_url":"https://github.com/googlecartographer","followers_url":"https://api.github.com/users/googlecartographer/followers","following_url":"https://api.github.com/users/googlecartographer/following{/other_user}","gists_url":"https://api.github.com/users/googlecartographer/gists{/gist_id}","starred_url":"https://api.github.com/users/googlecartographer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlecartographer/subscriptions","organizations_url":"https://api.github.com/users/googlecartographer/orgs","repos_url":"https://api.github.com/users/googlecartographer/repos","events_url":"https://api.github.com/users/googlecartographer/events{/privacy}","received_events_url":"https://api.github.com/users/googlecartographer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/googlecartographer/cartographer","description":"Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.","fork":false,"url":"https://api.github.com/repos/googlecartographer/cartographer","forks_url":"https://api.github.com/repos/googlecartographer/cartographer/forks","keys_url":"https://api.github.com/repos/googlecartographer/cartographer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/googlecartographer/cartographer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/googlecartographer/cartographer/teams","hooks_url":"https://api.github.com/repos/googlecartographer/cartographer/hooks","issue_events_url":"https://api.github.com/repos/googlecartographer/cartographer/issues/events{/number}","events_url":"https://api.github.com/repos/googlecartographer/cartographer/events","assignees_url":"https://api.github.com/repos/googlecartographer/cartographer/assignees{/user}","branches_url":"https://api.github.com/repos/googlecartographer/cartographer/branches{/branch}","tags_url":"https://api.github.com/repos/googlecartographer/cartographer/tags","blobs_url":"https://api.github.com/repos/googlecartographer/cartographer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/googlecartographer/cartographer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/googlecartographer/cartographer/git/refs{/sha}","trees_url":"https://api.github.com/repos/googlecartographer/cartographer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/googlecartographer/cartographer/statuses/{sha}","languages_url":"https://api.github.com/repos/googlecartographer/cartographer/languages","stargazers_url":"https://api.github.com/repos/googlecartographer/cartographer/stargazers","contributors_url":"https://api.github.com/repos/googlecartographer/cartographer/contributors","subscribers_url":"https://api.github.com/repos/googlecartographer/cartographer/subscribers","subscription_url":"https://api.github.com/repos/googlecartographer/cartographer/subscription","commits_url":"https://api.github.com/repos/googlecartographer/cartographer/commits{/sha}","git_commits_url":"https://api.github.com/repos/googlecartographer/cartographer/git/commits{/sha}","comments_url":"https://api.github.com/repos/googlecartographer/cartographer/comments{/number}","issue_comment_url":"https://api.github.com/repos/googlecartographer/cartographer/issues/comments{/number}","contents_url":"https://api.github.com/repos/googlecartographer/cartographer/contents/{+path}","compare_url":"https://api.github.com/repos/googlecartographer/cartographer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/googlecartographer/cartographer/merges","archive_url":"https://api.github.com/repos/googlecartographer/cartographer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/googlecartographer/cartographer/downloads","issues_url":"https://api.github.com/repos/googlecartographer/cartographer/issues{/number}","pulls_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls{/number}","milestones_url":"https://api.github.com/repos/googlecartographer/cartographer/milestones{/number}","notifications_url":"https://api.github.com/repos/googlecartographer/cartographer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/googlecartographer/cartographer/labels{/name}","releases_url":"https://api.github.com/repos/googlecartographer/cartographer/releases{/id}","deployments_url":"https://api.github.com/repos/googlecartographer/cartographer/deployments","created_at":"2016-08-02T06:55:43Z","updated_at":"2016-10-19T10:36:47Z","pushed_at":"2016-10-19T11:17:54Z","git_url":"git://github.com/googlecartographer/cartographer.git","ssh_url":"git@github.com:googlecartographer/cartographer.git","clone_url":"https://github.com/googlecartographer/cartographer.git","svn_url":"https://github.com/googlecartographer/cartographer","homepage":"","size":500,"stargazers_count":1823,"watchers_count":1823,"language":"C++","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":460,"mirror_url":null,"open_issues_count":7,"forks":460,"open_issues":7,"watchers":1823,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/80"},"html":{"href":"https://github.com/googlecartographer/cartographer/pull/80"},"issue":{"href":"https://api.github.com/repos/googlecartographer/cartographer/issues/80"},"comments":{"href":"https://api.github.com/repos/googlecartographer/cartographer/issues/80/comments"},"review_comments":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/80/comments"},"review_comment":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/80/commits"},"statuses":{"href":"https://api.github.com/repos/googlecartographer/cartographer/statuses/72266c4dbf7a42a276ac6c1a5c37d0100a4584a8"}}}}
{"actor":{"display_login":"damonkohler"}}