Пример #1
0
        public static CurveCollection FromVectorSets(IEnumerable <IEnumerable <Vector> > vectorsSets)
        {
            var curves = new CurveCollection();

            foreach (var vectors in vectorsSets)
            {
                curves.Add(new Curve(vectors));
            }
            return(curves);
        }
Пример #2
0
        public CurveCollection BreakApart()
        {
            CurveCollection result = new CurveCollection();

            foreach (Curve c in this)
            {
                foreach (Curve subc in c.Subcurves)
                {
                    result.Add(subc);
                }
            }

            return(result);
        }
Пример #3
0
        public void RemoveLooseEnds(CurveCollection curves)
        {
            for (int i = curves.Count - 1; i >= 0; i--)
            {
                bool foundStart = false;
                bool foundEnd   = false;
                for (int j = curves.Count - 1; j >= 0; j--)
                {
                    if (j == i)
                    {
                        continue;
                    }
                    if (
                        curves[i][0] == curves[j][0] ||
                        curves[i][0] == LastOf(curves[j]))
                    {
                        foundStart = true;
                    }
                    if (
                        LastOf(curves[i]) == LastOf(curves[j]) ||
                        LastOf(curves[i]) == curves[j][0])
                    {
                        foundEnd = true;
                    }

                    if (foundStart && foundEnd)
                    {
                        break;
                    }
                }
                if (!foundStart || !foundEnd)
                {
                    curves.RemoveAt(i);
                }
            }
        }