Example #1
0
        public static Line GetUnionLine([NotNull] this List <Line> lines)
        {
            using var wasteLines = new DisposableSet <Line>();
            Line prew      = null !;
            Line?unionLine = null;

            foreach (var l in lines)
            {
                if (prew == null)
                {
                    prew = l;
                    continue;
                }

                var line = prew.GetUnionLine(l);
                wasteLines.Add(line);
                unionLine = prew;
                prew      = line;
            }

            if (unionLine == null)
            {
                return((Line)prew.Clone());
            }

            wasteLines.Remove(prew);
            return(prew);
        }
Example #2
0
 private static Region GetRegion([NotNull] IEnumerable <Curve> pls)
 {
     using (var regions = new DisposableSet <Region>(pls.CreateRegion()))
     {
         var reg = regions.Skip(1).Any() ? regions.ToList().UnionRegions() : regions.First();
         regions.Remove(reg);
         return(reg);
     }
 }