private bool FindStar(FacetStars facetedMesh) { // Find a vertex having an unvisited facet atleast Func <Facet, bool> predicate; switch (Strategy) { case InvestigationStrategy.FirstWins: predicate = f => !_visited.Contains(f); break; case InvestigationStrategy.SameFaceFirst: predicate = f => !_visited.Contains(f) && (null == _representative || f.Meshed == _representative); break; default: throw new NotImplementedException($"Not implemented for '{Strategy}'"); } var star = facetedMesh.FirstOrDefault(f => f.Any(predicate)); if (null != star) { _pending.Push(star.Key); } return(null != star); }
/// <summary> /// A new packing state wrapping the given facet index. /// </summary> /// <param name="index">The facet index.</param> /// <param name="isVisitedDelegate">A delegate providing a flag whether a vertex has been visited yet or not</param> /// <param name="strategy">The investigation strategy</param> public FacetStarVisitor(FacetStars index, Func <uint, bool> isVisitedDelegate, InvestigationStrategy strategy = InvestigationStrategy.FirstWins) { Index = index; Strategy = strategy; FindStar(index); }