{"action":"created","comment":{"url":"https://api.github.com/repos/DGtal-team/DGtal/pulls/comments/40917496","id":40917496,"diff_hunk":"@@ -0,0 +1,218 @@\n+/**\n+ *  This program is free software: you can redistribute it and/or modify\n+ *  it under the terms of the GNU Lesser General Public License as\n+ *  published by the Free Software Foundation, either version 3 of the\n+ *  License, or  (at your option) any later version.\n+ *\n+ *  This program is distributed in the hope that it will be useful,\n+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ *  GNU General Public License for more details.\n+ *\n+ *  You should have received a copy of the GNU General Public License\n+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+ *\n+ **/\n+\n+#pragma once\n+\n+/**\n+ * @file FunctorsLambdaMST.h\n+ * @author Kacper Pluta (\\c kacper.pluta@esiee.fr )\n+ * Laboratoire d'Informatique Gaspard-Monge - LIGM, A3SI, France\n+ *\n+ * @date 2014/10/08\n+ *\n+ * This file is part of the DGtal library.\n+ */\n+\n+#if defined(FunctorsLambdaMST_RECURSES)\n+#error Recursive header files inclusion detected in FunctorsLambdaMST.h\n+#else // defined(FunctorsLambdaMST_RECURSES)\n+/** Prevents recursive inclusion of headers. */\n+#define FunctorsLambdaMST_RECURSES\n+\n+#if !defined FunctorsLambdaMST_h\n+/** Prevents repeated inclusion of headers. */\n+#define FunctorsLambdaMST_h\n+\n+//////////////////////////////////////////////////////////////////////////////\n+// Inclusions\n+#include <functional>\n+#include \"DGtal/base/Common.h\"\n+#include \"DGtal/geometry/curves/estimation/CLambdaFunctor.h\"\n+//////////////////////////////////////////////////////////////////////////////\n+\n+namespace DGtal\n+{\n+/////////////////////////////////////////////////////////////////////////////\n+/**\n+  * Description: Extension of namespace functors by functors related to L-MST.\n+  * \\brief Aim: Provide various lambda functions and others L-MST related functors.\n+  * \n+*/\n+\n+namespace functors\n+{\n+  /**\n+   * Model of CLambdaFunctor -- polynomial functor\n+   * \n+   */\n+  struct Lambda64Function : std::unary_function < double, double >\n+  {\n+      double operator() (double x) const\n+      {\n+          double e2 = x * x;\n+          double e3 = e2 * x;\n+          return 64.0 * ( -e3 * e3 + 3.0 * e3 * e2 - 3.0 * e2 * e2 + e3 );\n+      }\n+  };\n+  /**\n+   * Model of CLambdaFunctor -- sine lambda-functor\n+   * \n+   */\n+  struct LambdaSinFromPiFunction : std::unary_function < double, double >\n+  {\n+      double operator() (double x) const\n+      {\n+          return std::sin ( M_PI * x );\n+      }\n+  };\n+\n+  /**\n+   * Model of CLambdaFunctor -- exponential lambda-functor\n+   * \n+   */\n+  struct LambdaExponentialFunction : std::unary_function < double, double >\n+  {\n+      double operator() (double x) const\n+      {\n+          return 2.0 / ( std::exp ( 15.0 * ( x - 0.5 ) ) + std::exp ( -15.0 * ( x - 0.5 ) ) );\n+      }\n+  };\n+}\n+\n+/**\n+ * Description of class 'TangentFromDSS2DFunctor' -- model of CLMSTTangentFromDSS.\n+ * Aim: Provide a functor which calculate from digital straight segment \n+ * its direction and eccentricity around a given point.\n+ * @tparam DSS digital straight segment recognition algorithm\n+ * @tparam LambdaFunction model of CLambdaFunctor @see CLambdaFunctor.h\n+ */\n+template<typename DSS, typename LambdaFunction>\n+class TangentFromDSS2DFunctor\n+{\n+  // ----------------------- Types ------------------------------\n+public:\n+  typedef PointVector<2, double> RealVector;\n+  typedef DSS TDSS;\n+  \n+  struct Value\n+  {\n+    RealVector first;\n+    double second;\n+    Value () : second ( 0. ) {}\n+    Value & operator+= ( const Value & ch )\n+    {\n+      this->first += ch.first;\n+      this->second += ch.second;\n+      return *this;\n+    }\n+  };\n+  \n+  \n+  // ----------------------- Interface --------------------------------------\n+public:\n+  /**\n+   * Calculate a direction of the 2D DSS and an eccentricity of a given point in\n+   * this DSS.\n+   * @param aDSS digital straight segment\n+   * @param indexOfPointInDSS index of given point in aDSS\n+   * @param dssLen length of aDSS\n+   */\n+  Value operator() ( const TDSS& aDSS, const int & indexOfPointInDSS, const int & dssLen ) const\n+  {\n+    Value result;\n+    double norm = std::sqrt ( aDSS.a() * aDSS.a() + aDSS.b() * aDSS.b() );\n+    result.second = lambdaFunctor ( (double)indexOfPointInDSS / (double)dssLen );\n+    result.first[0] = result.second * aDSS.a () / norm;\n+    result.first[1] = result.second * aDSS.b () / norm;","path":"src/DGtal/geometry/curves/estimation/FunctorsLambdaMST.h","position":139,"original_position":139,"commit_id":"52e9aed55ceef367b0c460522fbb3ae6307ca45f","original_commit_id":"52e9aed55ceef367b0c460522fbb3ae6307ca45f","user":{"login":"copyme","id":456607,"avatar_url":"https://avatars.githubusercontent.com/u/456607?v=3","gravatar_id":"","url":"https://api.github.com/users/copyme","html_url":"https://github.com/copyme","followers_url":"https://api.github.com/users/copyme/followers","following_url":"https://api.github.com/users/copyme/following{/other_user}","gists_url":"https://api.github.com/users/copyme/gists{/gist_id}","starred_url":"https://api.github.com/users/copyme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/copyme/subscriptions","organizations_url":"https://api.github.com/users/copyme/orgs","repos_url":"https://api.github.com/users/copyme/repos","events_url":"https://api.github.com/users/copyme/events{/privacy}","received_events_url":"https://api.github.com/users/copyme/received_events","type":"User","site_admin":false},"body":"@dcoeurjo @JacquesOlivierLachaud Do we have in DGtal a class which represent rational numbers? I think boost has this implemented.","created_at":"2015-10-01T14:15:32Z","updated_at":"2015-10-01T14:15:32Z","html_url":"https://github.com/DGtal-team/DGtal/pull/1021#discussion_r40917496","pull_request_url":"https://api.github.com/repos/DGtal-team/DGtal/pulls/1021","_links":{"self":{"href":"https://api.github.com/repos/DGtal-team/DGtal/pulls/comments/40917496"},"html":{"href":"https://github.com/DGtal-team/DGtal/pull/1021#discussion_r40917496"},"pull_request":{"href":"https://api.github.com/repos/DGtal-team/DGtal/pulls/1021"}}},"pull_request":{"url":"https://api.github.com/repos/DGtal-team/DGtal/pulls/1021","id":38440889,"html_url":"https://github.com/DGtal-team/DGtal/pull/1021","diff_url":"https://github.com/DGtal-team/DGtal/pull/1021.diff","patch_url":"https://github.com/DGtal-team/DGtal/pull/1021.patch","issue_url":"https://api.github.com/repos/DGtal-team/DGtal/issues/1021","number":1021,"state":"open","locked":false,"title":"* Lambda-MST 2D/3D tangent estimator","user":{"login":"copyme","id":456607,"avatar_url":"https://avatars.githubusercontent.com/u/456607?v=3","gravatar_id":"","url":"https://api.github.com/users/copyme","html_url":"https://github.com/copyme","followers_url":"https://api.github.com/users/copyme/followers","following_url":"https://api.github.com/users/copyme/following{/other_user}","gists_url":"https://api.github.com/users/copyme/gists{/gist_id}","starred_url":"https://api.github.com/users/copyme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/copyme/subscriptions","organizations_url":"https://api.github.com/users/copyme/orgs","repos_url":"https://api.github.com/users/copyme/repos","events_url":"https://api.github.com/users/copyme/events{/privacy}","received_events_url":"https://api.github.com/users/copyme/received_events","type":"User","site_admin":false},"body":"* Naive3DDSSComputer - DSS computer which uses only valid projections\r\n* Another related changes","created_at":"2015-06-24T13:21:41Z","updated_at":"2015-10-01T14:15:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9be9cc3c024ac7a0c96449f5d0bc10ff3262c294","assignee":null,"milestone":{"url":"https://api.github.com/repos/DGtal-team/DGtal/milestones/9","html_url":"https://github.com/DGtal-team/DGtal/milestones/0.9","labels_url":"https://api.github.com/repos/DGtal-team/DGtal/milestones/9/labels","id":776797,"number":9,"title":"0.9","description":"","creator":{"login":"dcoeurjo","id":700165,"avatar_url":"https://avatars.githubusercontent.com/u/700165?v=3","gravatar_id":"","url":"https://api.github.com/users/dcoeurjo","html_url":"https://github.com/dcoeurjo","followers_url":"https://api.github.com/users/dcoeurjo/followers","following_url":"https://api.github.com/users/dcoeurjo/following{/other_user}","gists_url":"https://api.github.com/users/dcoeurjo/gists{/gist_id}","starred_url":"https://api.github.com/users/dcoeurjo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcoeurjo/subscriptions","organizations_url":"https://api.github.com/users/dcoeurjo/orgs","repos_url":"https://api.github.com/users/dcoeurjo/repos","events_url":"https://api.github.com/users/dcoeurjo/events{/privacy}","received_events_url":"https://api.github.com/users/dcoeurjo/received_events","type":"User","site_admin":false},"open_issues":20,"closed_issues":27,"state":"open","created_at":"2014-09-03T13:26:56Z","updated_at":"2015-10-01T07:18:35Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/DGtal-team/DGtal/pulls/1021/commits","review_comments_url":"https://api.github.com/repos/DGtal-team/DGtal/pulls/1021/comments","review_comment_url":"https://api.github.com/repos/DGtal-team/DGtal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DGtal-team/DGtal/issues/1021/comments","statuses_url":"https://api.github.com/repos/DGtal-team/DGtal/statuses/52e9aed55ceef367b0c460522fbb3ae6307ca45f","head":{"label":"copyme:LambdaMST","ref":"LambdaMST","sha":"52e9aed55ceef367b0c460522fbb3ae6307ca45f","user":{"login":"copyme","id":456607,"avatar_url":"https://avatars.githubusercontent.com/u/456607?v=3","gravatar_id":"","url":"https://api.github.com/users/copyme","html_url":"https://github.com/copyme","followers_url":"https://api.github.com/users/copyme/followers","following_url":"https://api.github.com/users/copyme/following{/other_user}","gists_url":"https://api.github.com/users/copyme/gists{/gist_id}","starred_url":"https://api.github.com/users/copyme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/copyme/subscriptions","organizations_url":"https://api.github.com/users/copyme/orgs","repos_url":"https://api.github.com/users/copyme/repos","events_url":"https://api.github.com/users/copyme/events{/privacy}","received_events_url":"https://api.github.com/users/copyme/received_events","type":"User","site_admin":false},"repo":{"id":19267623,"name":"DGtal","full_name":"copyme/DGtal","owner":{"login":"copyme","id":456607,"avatar_url":"https://avatars.githubusercontent.com/u/456607?v=3","gravatar_id":"","url":"https://api.github.com/users/copyme","html_url":"https://github.com/copyme","followers_url":"https://api.github.com/users/copyme/followers","following_url":"https://api.github.com/users/copyme/following{/other_user}","gists_url":"https://api.github.com/users/copyme/gists{/gist_id}","starred_url":"https://api.github.com/users/copyme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/copyme/subscriptions","organizations_url":"https://api.github.com/users/copyme/orgs","repos_url":"https://api.github.com/users/copyme/repos","events_url":"https://api.github.com/users/copyme/events{/privacy}","received_events_url":"https://api.github.com/users/copyme/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/copyme/DGtal","description":"Digital Geometry Tools and Algorithm Library","fork":true,"url":"https://api.github.com/repos/copyme/DGtal","forks_url":"https://api.github.com/repos/copyme/DGtal/forks","keys_url":"https://api.github.com/repos/copyme/DGtal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/copyme/DGtal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/copyme/DGtal/teams","hooks_url":"https://api.github.com/repos/copyme/DGtal/hooks","issue_events_url":"https://api.github.com/repos/copyme/DGtal/issues/events{/number}","events_url":"https://api.github.com/repos/copyme/DGtal/events","assignees_url":"https://api.github.com/repos/copyme/DGtal/assignees{/user}","branches_url":"https://api.github.com/repos/copyme/DGtal/branches{/branch}","tags_url":"https://api.github.com/repos/copyme/DGtal/tags","blobs_url":"https://api.github.com/repos/copyme/DGtal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/copyme/DGtal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/copyme/DGtal/git/refs{/sha}","trees_url":"https://api.github.com/repos/copyme/DGtal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/copyme/DGtal/statuses/{sha}","languages_url":"https://api.github.com/repos/copyme/DGtal/languages","stargazers_url":"https://api.github.com/repos/copyme/DGtal/stargazers","contributors_url":"https://api.github.com/repos/copyme/DGtal/contributors","subscribers_url":"https://api.github.com/repos/copyme/DGtal/subscribers","subscription_url":"https://api.github.com/repos/copyme/DGtal/subscription","commits_url":"https://api.github.com/repos/copyme/DGtal/commits{/sha}","git_commits_url":"https://api.github.com/repos/copyme/DGtal/git/commits{/sha}","comments_url":"https://api.github.com/repos/copyme/DGtal/comments{/number}","issue_comment_url":"https://api.github.com/repos/copyme/DGtal/issues/comments{/number}","contents_url":"https://api.github.com/repos/copyme/DGtal/contents/{+path}","compare_url":"https://api.github.com/repos/copyme/DGtal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/copyme/DGtal/merges","archive_url":"https://api.github.com/repos/copyme/DGtal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/copyme/DGtal/downloads","issues_url":"https://api.github.com/repos/copyme/DGtal/issues{/number}","pulls_url":"https://api.github.com/repos/copyme/DGtal/pulls{/number}","milestones_url":"https://api.github.com/repos/copyme/DGtal/milestones{/number}","notifications_url":"https://api.github.com/repos/copyme/DGtal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/copyme/DGtal/labels{/name}","releases_url":"https://api.github.com/repos/copyme/DGtal/releases{/id}","created_at":"2014-04-29T07:24:17Z","updated_at":"2014-06-26T08:23:45Z","pushed_at":"2015-09-28T09:22:59Z","git_url":"git://github.com/copyme/DGtal.git","ssh_url":"git@github.com:copyme/DGtal.git","clone_url":"https://github.com/copyme/DGtal.git","svn_url":"https://github.com/copyme/DGtal","homepage":"http://libdgtal.org","size":141669,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"DGtal-team:master","ref":"master","sha":"1f9c08ea3cc303bbb8e87e2dd23957f71db41959","user":{"login":"DGtal-team","id":1013900,"avatar_url":"https://avatars.githubusercontent.com/u/1013900?v=3","gravatar_id":"","url":"https://api.github.com/users/DGtal-team","html_url":"https://github.com/DGtal-team","followers_url":"https://api.github.com/users/DGtal-team/followers","following_url":"https://api.github.com/users/DGtal-team/following{/other_user}","gists_url":"https://api.github.com/users/DGtal-team/gists{/gist_id}","starred_url":"https://api.github.com/users/DGtal-team/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DGtal-team/subscriptions","organizations_url":"https://api.github.com/users/DGtal-team/orgs","repos_url":"https://api.github.com/users/DGtal-team/repos","events_url":"https://api.github.com/users/DGtal-team/events{/privacy}","received_events_url":"https://api.github.com/users/DGtal-team/received_events","type":"Organization","site_admin":false},"repo":{"id":1709095,"name":"DGtal","full_name":"DGtal-team/DGtal","owner":{"login":"DGtal-team","id":1013900,"avatar_url":"https://avatars.githubusercontent.com/u/1013900?v=3","gravatar_id":"","url":"https://api.github.com/users/DGtal-team","html_url":"https://github.com/DGtal-team","followers_url":"https://api.github.com/users/DGtal-team/followers","following_url":"https://api.github.com/users/DGtal-team/following{/other_user}","gists_url":"https://api.github.com/users/DGtal-team/gists{/gist_id}","starred_url":"https://api.github.com/users/DGtal-team/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DGtal-team/subscriptions","organizations_url":"https://api.github.com/users/DGtal-team/orgs","repos_url":"https://api.github.com/users/DGtal-team/repos","events_url":"https://api.github.com/users/DGtal-team/events{/privacy}","received_events_url":"https://api.github.com/users/DGtal-team/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DGtal-team/DGtal","description":"Digital Geometry Tools and Algorithm Library","fork":false,"url":"https://api.github.com/repos/DGtal-team/DGtal","forks_url":"https://api.github.com/repos/DGtal-team/DGtal/forks","keys_url":"https://api.github.com/repos/DGtal-team/DGtal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DGtal-team/DGtal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DGtal-team/DGtal/teams","hooks_url":"https://api.github.com/repos/DGtal-team/DGtal/hooks","issue_events_url":"https://api.github.com/repos/DGtal-team/DGtal/issues/events{/number}","events_url":"https://api.github.com/repos/DGtal-team/DGtal/events","assignees_url":"https://api.github.com/repos/DGtal-team/DGtal/assignees{/user}","branches_url":"https://api.github.com/repos/DGtal-team/DGtal/branches{/branch}","tags_url":"https://api.github.com/repos/DGtal-team/DGtal/tags","blobs_url":"https://api.github.com/repos/DGtal-team/DGtal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DGtal-team/DGtal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DGtal-team/DGtal/git/refs{/sha}","trees_url":"https://api.github.com/repos/DGtal-team/DGtal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DGtal-team/DGtal/statuses/{sha}","languages_url":"https://api.github.com/repos/DGtal-team/DGtal/languages","stargazers_url":"https://api.github.com/repos/DGtal-team/DGtal/stargazers","contributors_url":"https://api.github.com/repos/DGtal-team/DGtal/contributors","subscribers_url":"https://api.github.com/repos/DGtal-team/DGtal/subscribers","subscription_url":"https://api.github.com/repos/DGtal-team/DGtal/subscription","commits_url":"https://api.github.com/repos/DGtal-team/DGtal/commits{/sha}","git_commits_url":"https://api.github.com/repos/DGtal-team/DGtal/git/commits{/sha}","comments_url":"https://api.github.com/repos/DGtal-team/DGtal/comments{/number}","issue_comment_url":"https://api.github.com/repos/DGtal-team/DGtal/issues/comments{/number}","contents_url":"https://api.github.com/repos/DGtal-team/DGtal/contents/{+path}","compare_url":"https://api.github.com/repos/DGtal-team/DGtal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DGtal-team/DGtal/merges","archive_url":"https://api.github.com/repos/DGtal-team/DGtal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DGtal-team/DGtal/downloads","issues_url":"https://api.github.com/repos/DGtal-team/DGtal/issues{/number}","pulls_url":"https://api.github.com/repos/DGtal-team/DGtal/pulls{/number}","milestones_url":"https://api.github.com/repos/DGtal-team/DGtal/milestones{/number}","notifications_url":"https://api.github.com/repos/DGtal-team/DGtal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DGtal-team/DGtal/labels{/name}","releases_url":"https://api.github.com/repos/DGtal-team/DGtal/releases{/id}","created_at":"2011-05-06T00:20:52Z","updated_at":"2015-08-24T19:21:26Z","pushed_at":"2015-10-01T07:18:37Z","git_url":"git://github.com/DGtal-team/DGtal.git","ssh_url":"git@github.com:DGtal-team/DGtal.git","clone_url":"https://github.com/DGtal-team/DGtal.git","svn_url":"https://github.com/DGtal-team/DGtal","homepage":"http://dgtal.org","size":199074,"stargazers_count":31,"watchers_count":31,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"open_issues_count":40,"forks":39,"open_issues":40,"watchers":31,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DGtal-team/DGtal/pulls/1021"},"html":{"href":"https://github.com/DGtal-team/DGtal/pull/1021"},"issue":{"href":"https://api.github.com/repos/DGtal-team/DGtal/issues/1021"},"comments":{"href":"https://api.github.com/repos/DGtal-team/DGtal/issues/1021/comments"},"review_comments":{"href":"https://api.github.com/repos/DGtal-team/DGtal/pulls/1021/comments"},"review_comment":{"href":"https://api.github.com/repos/DGtal-team/DGtal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DGtal-team/DGtal/pulls/1021/commits"},"statuses":{"href":"https://api.github.com/repos/DGtal-team/DGtal/statuses/52e9aed55ceef367b0c460522fbb3ae6307ca45f"}}}}