@@ -453,7 +453,12 @@ std::tuple<std::vector<Scalar>, std::vector<Scalar>, std::vector<bool>> compute_
453453 int h = 0 ;
454454 if (start_h == -1 ) {
455455 for (int i = 0 ; i < m.n_halfedges (); i++) {
456- if (m.type [i] == 1 && m.type [m.opp [i]] == 2 ) h = m.n [m.n [i]];
456+ if (m.type [i] == 1 && m.type [m.opp [i]] == 2 )
457+ {
458+ h = m.n [m.n [i]];
459+ spdlog::debug (" Using edge {} as layout start" , h);
460+ break ;
461+ }
457462 }
458463 } else {
459464 assert (m.f [start_h] != -1 );
@@ -475,13 +480,15 @@ std::tuple<std::vector<Scalar>, std::vector<Scalar>, std::vector<bool>> compute_
475480 for (int i = 0 ; i < m.n_faces (); i++) {
476481 int hh = m.h [i];
477482 if (m.type [hh] == 2 && m.type [m.n [hh]] == 2 && m.type [m.n [m.n [hh]]] == 2 ) {
478- done[i] = true ;
483+ // TODO
484+ // done[i] = true;
479485 }
480486 }
481487 // set edge type 2 as cut
482488 for (int i = 0 ; i < num_halfedges; i++) {
483489 if (m.type [i] == 2 ) {
484- is_cut_h[i] = true ;
490+ // TODO
491+ // is_cut_h[i] = true;
485492 }
486493 }
487494
@@ -710,6 +717,7 @@ get_consistent_layout(
710717 std::vector<bool >());
711718 }
712719
720+ auto mc_type = mc.type ;
713721 mc.type = std::vector<char >(mc.n_halfedges (), 0 );
714722 // std::vector<bool> _is_cut_place_holder; // TODO Remove
715723 // auto layout_res = compute_layout(mc, u_vec, _is_cut_place_holder, 0);
@@ -753,9 +761,20 @@ get_consistent_layout(
753761 m.l [h0] = sqrt (
754762 (u_o[h0] - u_o[h1]) * (u_o[h0] - u_o[h1]) + (v_o[h0] - v_o[h1]) * (v_o[h0] - v_o[h1]));
755763 }
756- triangulate_polygon_mesh (m, u_o, v_o, f_labels);
757764 m.type = std::vector<char >(m.n .size (), 0 );
765+ int num_m_halfedges = m.n .size ();
766+ for (int hi = 0 ; hi < num_m_halfedges; ++hi) {
767+ if (m_o.edge_type [hi] == CURRENT_EDGE) {
768+ continue ;
769+ } else if (m_o.edge_type [hi] == ORIGINAL_AND_CURRENT_EDGE) {
770+ m.type [hi] = mc_type[m_o.origin_of_origin [hi]];
771+ } else if (m_o.edge_type [hi] == ORIGINAL_EDGE) {
772+ m.type [hi] = mc_type[m_o.origin [hi]];
773+ }
774+ }
758775 m.type_input = m.type ;
776+
777+ triangulate_polygon_mesh (m, u_o, v_o, f_labels);
759778 m.R = std::vector<int >(m.n .size (), 0 );
760779 m.v_rep = range (0 , m.out .size ());
761780 m.Th_hat = std::vector<Scalar>(m.out .size (), 0.0 );
0 commit comments