MCPcopy Create free account
hub / github.com/cutdigital/mcut / resolve_intersection_point_descriptor

Function resolve_intersection_point_descriptor

source/kernel.cpp:1194–1407  ·  view source on GitHub ↗

point an intersection halfedge to the correct instance of an intersection point

Source from the content-addressed store, hash-verified

1192
1193// point an intersection halfedge to the correct instance of an intersection point
1194vd_t resolve_intersection_point_descriptor(
1195 const hmesh_t& ps,
1196 const hmesh_t& m0,
1197 hmesh_t& m1,
1198 const hd_t& m0_h,
1199 const vd_t& m0_h_tgt,
1200 const vd_t& m1_h_tgt,
1201 const bool m0_h_is_ox,
1202 /*const*/ std::vector<std::vector<int>>& m0_h_to_ply,
1203 /*const*/ std::unordered_map<vd_t, std::vector<hd_t>>& ivtx_to_incoming_hlist,
1204 /*const*/ std::unordered_map<hd_t, bool>& m0_sm_ihe_to_flag,
1205 const std::vector<std::pair<ed_t, fd_t>>& m0_ivtx_to_intersection_registry_entry,
1206 /*const*/ std::unordered_map<hd_t, hd_t>& m0_to_m1_ihe,
1207 // const std::map<vd_t, vd_t> &m0_to_ps_vtx,
1208 const std::vector<vd_t>& m0_to_ps_vtx,
1209 const int ps_vtx_cnt,
1210 const int sm_vtx_cnt,
1211 const int sm_face_count,
1212 const int m0_num_cutpath_halfedges)
1213{
1214 // the descriptor instance we want to return
1215 vd_t resolved_inst = m1_h_tgt;
1216
1217 // First, we get list of all other halfedges in (in "m0") whose target-vertex
1218 // is the same as the target of the current halfedge
1219 const std::vector<hd_t>& incoming = SAFE_ACCESS(ivtx_to_incoming_hlist, m0_h_tgt);
1220
1221 // the minimum number of halfedges whose target is "m0_h_tgt"
1222 // this "minimum" case come from interior edges
1223 MCUT_ASSERT(incoming.size() >= 2);
1224
1225 // Second, we will now filter "incoming" (those pointing to "m0_h_tgt") by
1226 // keeping only the halfedges which are:
1227 // 1) Processed/transformed (so that we can use it to infer what to do with "resolved_inst")
1228 // 2) are incident to a traced polygon, and
1229 // 3) used by a traced polygon of the src-mesh
1230 //
1231 // The remaining halfedges will be the ones we can use to infer the correct value of "resolved_inst"
1232
1233 std::vector<hd_t> halfedges_across_cut_path = incoming;
1234
1235 // for each halfedge across the cut-path
1236 for (std::vector<hd_t>::iterator halfedge_across_cut_path_iter = halfedges_across_cut_path.begin();
1237 halfedge_across_cut_path_iter != halfedges_across_cut_path.end();) {
1238
1239 const vd_t s = m0.source(*halfedge_across_cut_path_iter);
1240 const vd_t t = m0.target(*halfedge_across_cut_path_iter);
1241 const bool s_is_ivtx = m0_is_intersection_point(s, ps_vtx_cnt);
1242 const bool t_is_ivtx = m0_is_intersection_point(t, ps_vtx_cnt);
1243
1244 // check if the halfedge is only next to the cut-mesh
1245
1246 const bool is_ox_cs_h = (!s_is_ivtx && ps_is_cutmesh_vertex(SAFE_ACCESS(m0_to_ps_vtx, s), sm_vtx_cnt));
1247 const bool is_xo_cs_h = (!t_is_ivtx && ps_is_cutmesh_vertex(SAFE_ACCESS(m0_to_ps_vtx, t), sm_vtx_cnt));
1248 bool is_strictly_cs_h = is_ox_cs_h || is_xo_cs_h; // check if halfedge is used only by a cut-surface polygon
1249 const bool is_xx = s_is_ivtx && t_is_ivtx;
1250
1251 if (!is_strictly_cs_h && is_xx) {

Callers 1

dispatchFunction · 0.85

Calls 15

m0_is_intersection_pointFunction · 0.85
ps_is_cutmesh_vertexFunction · 0.85
ps_is_cutmesh_faceFunction · 0.85
sourceMethod · 0.80
targetMethod · 0.80
halfedgeMethod · 0.80
faceMethod · 0.80
oppositeMethod · 0.80
prevMethod · 0.80
add_vertexMethod · 0.80
vertexMethod · 0.80

Tested by

no test coverage detected