Beispiel #1
0
        public static List <EdgeProjection> TryInsertFamily(SegmentFamilySubset subset, ProjectionCurrentState state)
        {
            if (state.SegmentIsCovered(subset))
            {
                return(null);
            }
            var start = state.GetNode(subset.Begin);

            if (start == null)
            {
                return(null);
            }
            var end = state.GetNode(subset.End);

            if (end == null)
            {
                return(null);
            }

            var result = new List <EdgeProjection>();

            foreach (var s in state.nodesMap[start])
            {
                foreach (var f in state.nodesMap[end])
                {
                    var length = new Segment(s.Projection, f.Projection).QuadratOfLength;
                    if (length != new Segment(subset.Begin, subset.End).QuadratOfLength)
                    {
                        continue;
                    }
                    result.Add(new EdgeProjection {
                        begin = s, end = f, Segments = subset.Insides.ToList()
                    });
                }
            }
            return(result);
        }
 public bool SegmentIsCovered(SegmentFamilySubset subs)
 {
     return(subs.Insides.All(z => edgesMap[z].Count != 0));
 }