bool OVERSKETCH::find_matching_sil(CGESTUREptr& g) { err_adv(debug, "OVERSKETCH::find_matching_sil"); const size_t MIN_GEST_PTS = 10; if (!(g && g->pts().size() >= MIN_GEST_PTS)) return false; if (BMESH::_freeze_sils) return false; VisRefImage *vis_ref = VisRefImage::lookup(VIEW::peek()); if (!vis_ref) return false; // 1. see if the gesture runs along a silhouette // of a single mesh. SilEdgeFilter sil_filter; const PIXEL_list& pts = g->pts(); BMESHptr mesh = nullptr; for (PIXEL_list::size_type i=0; i<pts.size(); i++) { Bedge* e = (Bedge*) vis_ref->find_near_simplex(pts[i], SIL_SEARCH_RAD, sil_filter); if (!(e && e->mesh())) { err_adv(debug, " gesture too far from silhouette"); return false; } if (mesh && mesh != e->mesh()) { err_adv(debug, " found a second mesh, rejecting"); return false; } mesh = e->mesh(); } if (!dynamic_pointer_cast<LMESH>(mesh)) { err_adv(debug, " found non-LMESH, rejecting"); return false; } err_adv(debug, " gesture aligns with silhouette"); err_adv(debug, " mesh level %d", mesh->subdiv_level()); // 2. extract the portion of the silhouette that matches // the gesture, store in _selected_sils return find_matching_sil(pts, mesh->sil_strip()); }