@@ -168,7 +168,6 @@ void write_obj_with_uv(
168168 igl::writeOBJ (filename, V, F, N, FN, uv, F_uv);
169169}
170170
171-
172171std::
173172 tuple<
174173 OverlayMesh<Scalar>, // m_o
@@ -195,11 +194,52 @@ std::
195194 Mesh<Scalar> m =
196195 FV_to_double (V, F, V, F, Th_hat, vtx_reindex, indep_vtx, dep_vtx, v_rep, bnd_loops);
197196
197+ return generate_VF_mesh_from_halfedge_metric (V, m, vtx_reindex, initial_cone_metric, reduced_metric_coords, cut_h, do_best_fit_scaling);
198+ }
199+
200+
201+ std::vector<bool > find_boundary_vertices (const Mesh<Scalar>& m)
202+ {
203+ std::vector<bool > is_bd (m.n_ind_vertices (), false );
204+ for (int i = 0 ; i < m.n_halfedges (); i++) {
205+ if ((m.type [i] == 1 ) && (m.type [m.opp [i]] == 2 ))
206+ {
207+ is_bd[m.v_rep [m.to [i]]] = true ;
208+ }
209+ }
210+
211+ return is_bd;
212+ }
213+
214+ std::
215+ tuple<
216+ OverlayMesh<Scalar>, // m_o
217+ Eigen::MatrixXd, // V_o
218+ Eigen::MatrixXi, // F_o
219+ Eigen::MatrixXd, // uv_o
220+ Eigen::MatrixXi, // FT_o
221+ std::vector<bool >, // is_cut_h
222+ std::vector<bool >, // is_cut_o
223+ std::vector<int >, // Fn_to_F
224+ std::vector<std::pair<int , int >> // endpoints_o
225+ >
226+ generate_VF_mesh_from_halfedge_metric (
227+ const Eigen::MatrixXd& V,
228+ const Mesh<Scalar>& m,
229+ const std::vector<int >& vtx_reindex,
230+ const DifferentiableConeMetric& initial_cone_metric,
231+ const VectorX& reduced_metric_coords,
232+ std::vector<bool > cut_h,
233+ bool do_best_fit_scaling)
234+ {
198235 // Get metric target coordinates
199236 auto cone_metric = initial_cone_metric.set_metric_coordinates (reduced_metric_coords);
200237 VectorX metric_target = initial_cone_metric.get_metric_coordinates ();
201238 VectorX metric_coords = cone_metric->get_metric_coordinates ();
202239
240+ // Get boundary vertices
241+ std::vector<bool > is_bd = find_boundary_vertices (m);
242+
203243 // Fit conformal scale factors
204244 VectorX metric_coords_scaled = metric_coords;
205245 VectorX scale_factors;
@@ -241,7 +281,7 @@ std::
241281 reverse_interpolation_mesh,
242282 V_overlay);
243283 OverlayMesh<Scalar> m_o = interpolation_mesh.get_overlay_mesh ();
244- make_tufted_overlay (m_o, V, F, Th_hat );
284+ make_tufted_overlay (m_o);
245285
246286 // Get endpoints
247287 std::vector<std::pair<int , int >> endpoints;
@@ -267,12 +307,11 @@ std::
267307 // auto parametrize_res = overlay_mesh_to_VL<Scalar>(V, F, Th_hat, m_o, u, V_overlay_vec,
268308 // vtx_reindex_mutable, endpoints, -1); FIXME
269309 return consistent_overlay_mesh_to_VL (
270- F,
271- Th_hat,
272310 m_o,
311+ vtx_reindex,
312+ is_bd,
273313 u,
274314 V_overlay_vec,
275- vtx_reindex_mutable,
276315 endpoints,
277316 is_cut,
278317 {});
@@ -298,6 +337,9 @@ std::
298337 Mesh<Scalar> m =
299338 FV_to_double (V, F, V, F, Th_hat, vtx_reindex, indep_vtx, dep_vtx, v_rep, bnd_loops);
300339
340+ // Get boundary vertices
341+ std::vector<bool > is_bd = find_boundary_vertices (m);
342+
301343 // Get layout topology from mesh
302344 std::vector<bool > is_cut = compute_layout_topology (m, cut_h);
303345
@@ -306,7 +348,7 @@ std::
306348
307349 // Create trivial overlay mesh
308350 OverlayMesh<Scalar> m_o (discrete_metric);
309- make_tufted_overlay (m_o, V, F, Th_hat );
351+ make_tufted_overlay (m_o);
310352
311353 // Convert vertices to transposed vector format
312354 std::vector<std::vector<Scalar>> V_overlay_vec (3 );
@@ -323,14 +365,13 @@ std::
323365
324366 // Compute layout
325367 std::vector<Scalar> u_vec (m.n_ind_vertices (), 0.0 );
326- std::vector<int > vtx_reindex_mutable = vtx_reindex;
368+ // std::vector<int> vtx_reindex_mutable = vtx_reindex;
327369 auto layout_res = consistent_overlay_mesh_to_VL (
328- F,
329- Th_hat,
330370 m_o,
371+ vtx_reindex,
372+ is_bd,
331373 u_vec,
332374 V_overlay_vec,
333- vtx_reindex_mutable,
334375 endpoints,
335376 is_cut,
336377 {});
0 commit comments