/// <summary> /// Remove a span of edges that are within a distance threshold from rest of graph. /// Walk forward from start_vid along edge first_eid, and keep walking & discarding /// until we find a point we want to keep /// </summary> private void decimate_forward(int start_vid, int first_eid, double dist_thresh) { int cur_eid = first_eid; int cur_vid = start_vid; System.Diagnostics.Debug.Assert(Graph.IsEdge(cur_eid)); bool stop = false; while (!stop) { Index2i nextinfo = DGraph2Util.NextEdgeAndVtx(cur_eid, cur_vid, Graph); if (PreserveEdgeFilterF(cur_eid)) { break; } edge_hash.RemoveSegmentUnsafe(cur_eid, Graph.GetEdgeCenter(cur_eid)); Graph.RemoveEdge(cur_eid, true); if (nextinfo.a == int.MaxValue) { break; } cur_eid = nextinfo.a; cur_vid = nextinfo.b; double dist = MinSelfSegDistance(cur_vid, 2 * dist_thresh); double collision_dist = MinCollisionConstraintDistance(cur_vid, dist_thresh); if (dist > dist_thresh && collision_dist > CollisionRadius) { stop = true; } } }