bool Skin::gen_verts(CBvert_list& skel_verts, CVertMapper& skel_mapper) { // like plain gen_verts(), but take into account skel verts that // are "identified" together. i.e. if s1 and s2 are skel verts that // are identified together, we create just a single skin vert // corresponding to both s1 and s2. // first generate skin verts for the skel verts that are // mapped *to* by other skel verts if (!gen_verts(skel_mapper.B())) { err_adv(debug, "Skin::gen_verts: can't replicate skel verts (pass 1)"); return false; } // now create a skel-to-skin association of each mapped-from // skel vert thru its skel counterpart to the skin vert if (!_mapper.is_valid()) err_msg(" invalid mapper before gen_verts"); _mapper.add(skel_mapper.A(), _mapper.a_to_b(skel_mapper.B())); if (!_mapper.is_valid()) err_msg(" invalid mapper after gen_verts"); // now do the rest to make sure all are covered if (!gen_verts(skel_verts)) { err_adv(debug, "Skin::gen_verts: can't replicate skel verts (pass 2)"); return false; } return true; }
inline VertMapper subdiv_mapper(CVertMapper& pmap) { Bedge_list a_edges = pmap.a_edges(); Bedge_list b_edges = pmap.a_to_b(a_edges); assert(a_edges.num() == b_edges.num()); if (0 && debug) { err_msg("parents: verts: %d --> %d, edges: %d --> %d", pmap.A().num(), pmap.B().num(), a_edges.num(), b_edges.num()); err_msg("children: verts: %d --> %d", (child_verts<Bvert_list,Lvert>(pmap.A()) + child_verts<Bedge_list,Ledge>(a_edges)).num(), (child_verts<Bvert_list,Lvert>(pmap.B()) + child_verts<Bedge_list,Ledge>(b_edges)).num()); Bvert_list c = (child_verts<Bvert_list,Lvert>(pmap.A()) + child_verts<Bedge_list,Ledge>(a_edges)); if (c.has_duplicates()) { err_msg("*** child verts have duplicates ***"); if (pmap.A().has_duplicates()) { err_msg(" A verts have duplicates"); } if (pmap.a_edges().has_duplicates()) { err_msg(" A edges have duplicates"); } if (child_verts<Bvert_list,Lvert>(pmap.A()).has_duplicates()) { err_msg(" vert children have duplicates"); } if (child_verts<Bedge_list,Ledge>(pmap.a_edges()).has_duplicates()) { err_msg(" edge children have duplicates"); } WORLD::show_pts(c.pts()); } } return VertMapper( child_verts<Bvert_list,Lvert>(pmap.A()) + child_verts<Bedge_list,Ledge>(a_edges), child_verts<Bvert_list,Lvert>(pmap.B()) + child_verts<Bedge_list,Ledge>(b_edges) ); }
inline void report(CVertMapper& mapper, Cstr_ptr& msg) { err_msg(" %s: %d verts to %d verts, %d edges to %d edges", **msg, mapper.A().num(), mapper.B().num(), mapper.a_edges().num(), mapper.a_to_b(mapper.a_edges()).num()); }