Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
SaillantNicolas committed Aug 8, 2024
1 parent 60d339e commit 41d5657
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,9 @@
<div class="line"> std::vector&lt;std::pair&lt;Mesh::Vertex_index, Mesh::Vertex_index&gt;&gt; correspondences_mesh;</div>
<div class="line"> std::ifstream corr(corr_fn);</div>
<div class="line"> <span class="keywordflow">if</span> (corr.is_open()) {</div>
<div class="line"> std::string line;</div>
<div class="line"> <span class="keywordflow">while</span> (std::getline(corr, line)) {</div>
<div class="line"> <span class="keywordflow">if</span> (line.size() == 0) <span class="keywordflow">continue</span>;</div>
<div class="line"> std::istringstream iss(line);</div>
<div class="line"> </div>
<div class="line"> std::size_t v0, v1;</div>
<div class="line"> <span class="keywordflow">if</span> (iss &gt;&gt; v0 &gt;&gt; v1)</div>
<div class="line"> Mesh source, target;</div>
<div class="line"> std::size_t v0, v1;</div>
<div class="line"> <span class="keywordflow">while</span> (corr &gt;&gt; v0 &gt;&gt; v1) {</div>
<div class="line"> std::cout &lt;&lt; v0 &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; v1 &lt;&lt; std::endl;</div>
<div class="line"> correspondences_mesh.push_back(std::make_pair(*(source.vertices_begin() + v0), *(target.vertices_begin() + v1)));</div>
<div class="line"> }</div>
<div class="line"> </div>
Expand All @@ -230,28 +225,12 @@
<div class="line"> <span class="keywordflow">if</span> (vnm.second)</div>
<div class="line"> PMP::compute_vertex_normals(target, vnm.first);</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">typename</span> Mesh::Property_map&lt;Mesh::Vertex_index, CGAL::Aff_transformation_3&lt;K&gt;&gt; vrm = source.add_property_map&lt;Mesh::Vertex_index, CGAL::Aff_transformation_3&lt;K&gt;&gt;(<span class="stringliteral">&quot;v:rotation&quot;</span>).first;</div>
<div class="line"> <span class="keyword">typename</span> Mesh::Property_map&lt;Mesh::Vertex_index, K::Vector_3&gt; vtm = source.add_property_map&lt;Mesh::Vertex_index, K::Vector_3&gt;(<span class="stringliteral">&quot;v:transformations&quot;</span>).first;</div>
<div class="line"> </div>
<div class="line"><span class="comment">/*</span></div>
<div class="line"><span class="comment"> CGAL::Point_set_3&lt;K::Point_3&gt; points;</span></div>
<div class="line"><span class="comment"> points.reserve(target.num_vertices());</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment"> for (auto v : target.vertices())</span></div>
<div class="line"><span class="comment"> points.insert(target.point(v), get(vnm.first, v));</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment"> std::vector&lt;std::pair&lt;Mesh::Vertex_index, std::size_t&gt;&gt; correspondences_pts;</span></div>
<div class="line"><span class="comment"> correspondences_pts.reserve(correspondences_mesh.size());</span></div>
<div class="line"><span class="comment"> for (auto p : correspondences_mesh)</span></div>
<div class="line"><span class="comment"> correspondences_pts.push_back(std::make_pair(p.first, static_cast&lt;std::size_t&gt;(p.second)));</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment"> PMP::non_rigid_mesh_to_points_registration(source, points, vtm, vrm, correspondences_pts, CGAL::parameters::point_to_plane_energy(2.0).point_to_point_energy(0.1).as_rigid_as_possible_energy(10));</span></div>
<div class="line"><span class="comment"> PMP::apply_non_rigid_transformation(source, vtm, vrm);</span></div>
<div class="line"><span class="comment"> CGAL::IO::write_polygon_mesh(&quot;mapped.off&quot;, source);*/</span></div>
<div class="line"> Mesh::Property_map&lt;Mesh::Vertex_index, CGAL::Aff_transformation_3&lt;K&gt;&gt; vrm = source.add_property_map&lt;Mesh::Vertex_index, CGAL::Aff_transformation_3&lt;K&gt;&gt;(<span class="stringliteral">&quot;v:rotation&quot;</span>).first;</div>
<div class="line"> Mesh::Property_map&lt;Mesh::Vertex_index, K::Vector_3&gt; vtm = source.add_property_map&lt;Mesh::Vertex_index, K::Vector_3&gt;(<span class="stringliteral">&quot;v:translation&quot;</span>).first;</div>
<div class="line"> </div>
<div class="line"> FT w1 = 1.0;</div>
<div class="line"> FT w2 = 2.0;</div>
<div class="line"> FT w3 = 5000000;</div>
<div class="line"> FT w3 = 500;</div>
<div class="line"> </div>
<div class="line"> PMP::non_rigid_mesh_to_mesh_registration(source, target, vtm, vrm, correspondences_mesh, CGAL::parameters::point_to_point_energy(w1).point_to_plane_energy(w2).as_rigid_as_possible_energy(w3));</div>
<div class="line"> PMP::apply_non_rigid_transformation(source, vtm, vrm);</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ <h2 class="memtitle"><span class="permalink"><a href="#ga8f009d2c73e58129c96ec9a
<table class="params">
<tr><td class="paramname">source</td><td>the triangle mesh that should be mapped onto <code>target</code> </td></tr>
<tr><td class="paramname">target</td><td>the target triangle mesh </td></tr>
<tr><td class="paramname">vtm</td><td>a writeable vertex property map of <code>source</code> to store the translation vector of the registration </td></tr>
<tr><td class="paramname">vrm</td><td>a writeable vertex property map of <code>source</code> to store the rotation part of the registration </td></tr>
<tr><td class="paramname">vtm</td><td>a writable vertex property map of <code>source</code> to store the translation vector of the registration </td></tr>
<tr><td class="paramname">vrm</td><td>a writable vertex property map of <code>source</code> to store the rotation part of the registration </td></tr>
<tr><td class="paramname">np1</td><td>an optional sequence of <a class="el" href="group__PMP__intersection__grp.html#ga10428990783d0fc500bb1be8e5d10a42">Named Parameters1</a> of the <code>source</code> and the method among the ones listed below </td></tr>
<tr><td class="paramname">np2</td><td>an optional sequence of <a class="el" href="group__PMP__intersection__grp.html#ga10428990783d0fc500bb1be8e5d10a42">Named Parameters2</a> of the <code>target</code> providing a vertex point map and a vertex normal map </td></tr>
<tr><td class="paramname">correspondences</td><td>a vector given matching points between the <code>source</code> and the <code>target</code></td></tr>
Expand Down Expand Up @@ -396,7 +396,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#ga8f009d2c73e58129c96ec9a
<tr>
<td> <button class="collapsible"> <b>as_rigid_as_possible_energy</b> </button> <div class="content"><ul>
<li>
uses the topology of the mesh to determine how a vertex it deforming with respect to its neighbors. </li>
defines the rigidity of the registration </li>
<li>
<b>Type: </b>double </li>
<li>
Expand All @@ -406,9 +406,9 @@ <h2 class="memtitle"><span class="permalink"><a href="#ga8f009d2c73e58129c96ec9a
<p class="endtd"></p>
</td></tr>
<tr>
<td> <button class="collapsible"> <b>max_matching_dist</b> </button> <div class="content"><ul>
<td> <button class="collapsible"> <b>maximum_matching_distance</b> </button> <div class="content"><ul>
<li>
the maximum distance for a vertex in <code>source</code> to match with a vertex in <code>target</code>. 0 means that there is no max distance. </li>
the maximum distance for a vertex in <code>source</code> to match with a point in <code>target</code>. The default value 0 means no maximum matching distance. </li>
<li>
<b>Type: </b>double </li>
<li>
Expand Down Expand Up @@ -514,9 +514,9 @@ <h2 class="memtitle"><span class="permalink"><a href="#gafebc57d7544dd2c7c9feaaf
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">source</td><td>the triangle mesh that should be mapped onto <code>target</code>. </td></tr>
<tr><td class="paramname">target</td><td>the target triangle mesh. </td></tr>
<tr><td class="paramname">vtm</td><td>a writeable vertex property map of <code>source</code> to store the translation vector of the registration. </td></tr>
<tr><td class="paramname">vrm</td><td>a writeable vertex property map of <code>source</code> to store the rotation part of the registration. </td></tr>
<tr><td class="paramname">target</td><td>the target point set. </td></tr>
<tr><td class="paramname">vtm</td><td>a writable vertex property map of <code>source</code> to store the translation vector of the registration. </td></tr>
<tr><td class="paramname">vrm</td><td>a writable vertex property map of <code>source</code> to store the rotation part of the registration. </td></tr>
<tr><td class="paramname">np1</td><td>an optional sequence of <a class="el" href="group__PMP__intersection__grp.html#ga10428990783d0fc500bb1be8e5d10a42">Named Parameters</a> among the ones listed below </td></tr>
<tr><td class="paramname">np2</td><td>an optional sequence of <a class="el" href="group__PMP__intersection__grp.html#ga10428990783d0fc500bb1be8e5d10a42">Named Parameters</a> providing a point_map and normal_map for the <code>PointRange</code> </td></tr>
<tr><td class="paramname">correspondences</td><td>a vector given matching points between the <code>source</code> and the <code>target</code></td></tr>
Expand Down Expand Up @@ -565,19 +565,19 @@ <h2 class="memtitle"><span class="permalink"><a href="#gafebc57d7544dd2c7c9feaaf
<tr>
<td> <button class="collapsible"> <b>as_rigid_as_possible_energy</b> </button> <div class="content"><ul>
<li>
uses the topology of the mesh to determine how a vertex it deforming with respect to its neighbors </li>
defines the rigidity of the registration </li>
<li>
<b>Type: </b>double </li>
<li>
<b>Default: </b><code>20</code> </li>
<b>Default: </b><code>50</code> </li>
</ul>
</div> </td><td><p class="starttd"></p>
<p class="endtd"></p>
</td></tr>
<tr>
<td> <button class="collapsible"> <b>max_matching_dist</b> </button> <div class="content"><ul>
<li>
the maximum distance for a vertex in source to match with a point in target </li>
the maximum distance for a vertex in <code>source</code> to match with a point in <code>target</code>. The default value 0 means no maximum matching distance. </li>
<li>
<b>Type: </b>double </li>
<li>
Expand Down
33 changes: 6 additions & 27 deletions build_doc/doc_output/Polygon_mesh_processing/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2882,14 +2882,9 @@ <h2><a class="anchor" id="PMPNonRigidRegistrationExample"></a>
<div class="line"> std::vector&lt;std::pair&lt;Mesh::Vertex_index, Mesh::Vertex_index&gt;&gt; correspondences_mesh;</div>
<div class="line"> std::ifstream corr(corr_fn);</div>
<div class="line"> <span class="keywordflow">if</span> (corr.is_open()) {</div>
<div class="line"> std::string line;</div>
<div class="line"> <span class="keywordflow">while</span> (std::getline(corr, line)) {</div>
<div class="line"> <span class="keywordflow">if</span> (line.size() == 0) <span class="keywordflow">continue</span>;</div>
<div class="line"> std::istringstream iss(line);</div>
<div class="line"> </div>
<div class="line"> std::size_t v0, v1;</div>
<div class="line"> <span class="keywordflow">if</span> (iss &gt;&gt; v0 &gt;&gt; v1)</div>
<div class="line"> Mesh source, target;</div>
<div class="line"> std::size_t v0, v1;</div>
<div class="line"> <span class="keywordflow">while</span> (corr &gt;&gt; v0 &gt;&gt; v1) {</div>
<div class="line"> std::cout &lt;&lt; v0 &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; v1 &lt;&lt; std::endl;</div>
<div class="line"> correspondences_mesh.push_back(std::make_pair(*(source.vertices_begin() + v0), *(target.vertices_begin() + v1)));</div>
<div class="line"> }</div>
<div class="line"> </div>
Expand All @@ -2900,28 +2895,12 @@ <h2><a class="anchor" id="PMPNonRigidRegistrationExample"></a>
<div class="line"> <span class="keywordflow">if</span> (vnm.second)</div>
<div class="line"> PMP::compute_vertex_normals(target, vnm.first);</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">typename</span> Mesh::Property_map&lt;Mesh::Vertex_index, CGAL::Aff_transformation_3&lt;K&gt;&gt; vrm = source.add_property_map&lt;Mesh::Vertex_index, CGAL::Aff_transformation_3&lt;K&gt;&gt;(<span class="stringliteral">&quot;v:rotation&quot;</span>).first;</div>
<div class="line"> <span class="keyword">typename</span> Mesh::Property_map&lt;Mesh::Vertex_index, K::Vector_3&gt; vtm = source.add_property_map&lt;Mesh::Vertex_index, K::Vector_3&gt;(<span class="stringliteral">&quot;v:transformations&quot;</span>).first;</div>
<div class="line"> </div>
<div class="line"><span class="comment">/*</span></div>
<div class="line"><span class="comment"> CGAL::Point_set_3&lt;K::Point_3&gt; points;</span></div>
<div class="line"><span class="comment"> points.reserve(target.num_vertices());</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment"> for (auto v : target.vertices())</span></div>
<div class="line"><span class="comment"> points.insert(target.point(v), get(vnm.first, v));</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment"> std::vector&lt;std::pair&lt;Mesh::Vertex_index, std::size_t&gt;&gt; correspondences_pts;</span></div>
<div class="line"><span class="comment"> correspondences_pts.reserve(correspondences_mesh.size());</span></div>
<div class="line"><span class="comment"> for (auto p : correspondences_mesh)</span></div>
<div class="line"><span class="comment"> correspondences_pts.push_back(std::make_pair(p.first, static_cast&lt;std::size_t&gt;(p.second)));</span></div>
<div class="line"><span class="comment"></span> </div>
<div class="line"><span class="comment"> PMP::non_rigid_mesh_to_points_registration(source, points, vtm, vrm, correspondences_pts, CGAL::parameters::point_to_plane_energy(2.0).point_to_point_energy(0.1).as_rigid_as_possible_energy(10));</span></div>
<div class="line"><span class="comment"> PMP::apply_non_rigid_transformation(source, vtm, vrm);</span></div>
<div class="line"><span class="comment"> CGAL::IO::write_polygon_mesh(&quot;mapped.off&quot;, source);*/</span></div>
<div class="line"> Mesh::Property_map&lt;Mesh::Vertex_index, CGAL::Aff_transformation_3&lt;K&gt;&gt; vrm = source.add_property_map&lt;Mesh::Vertex_index, CGAL::Aff_transformation_3&lt;K&gt;&gt;(<span class="stringliteral">&quot;v:rotation&quot;</span>).first;</div>
<div class="line"> Mesh::Property_map&lt;Mesh::Vertex_index, K::Vector_3&gt; vtm = source.add_property_map&lt;Mesh::Vertex_index, K::Vector_3&gt;(<span class="stringliteral">&quot;v:translation&quot;</span>).first;</div>
<div class="line"> </div>
<div class="line"> FT w1 = 1.0;</div>
<div class="line"> FT w2 = 2.0;</div>
<div class="line"> FT w3 = 5000000;</div>
<div class="line"> FT w3 = 500;</div>
<div class="line"> </div>
<div class="line"> PMP::non_rigid_mesh_to_mesh_registration(source, target, vtm, vrm, correspondences_mesh, CGAL::parameters::point_to_point_energy(w1).point_to_plane_energy(w2).as_rigid_as_possible_energy(w3));</div>
<div class="line"> PMP::apply_non_rigid_transformation(source, vtm, vrm);</div>
Expand Down

0 comments on commit 41d5657

Please sign in to comment.