Exemplo n.º 1
0
        void Append(SmoothCurveElement cTo, SmoothCurveElement cAppend)
        {
            ParametricCurveSequence2 use = null;

            if (cTo.source is ParametricCurveSequence2)
            {
                use = cTo.source as ParametricCurveSequence2;
            }
            else
            {
                use = new ParametricCurveSequence2();
                use.Append(cTo.source);
            }

            if (cAppend.source is ParametricCurveSequence2)
            {
                var cseq = cAppend.source as ParametricCurveSequence2;
                foreach (var c in cseq.Curves)
                {
                    use.Append(c);
                }
            }
            else
            {
                use.Append(cAppend.source);
            }

            cTo.source = use;
            UpdateSampling(cTo);
        }
Exemplo n.º 2
0
        public static IParametricCurve2d Convert(Polygon2d poly)
        {
            ParametricCurveSequence2 seq = new ParametricCurveSequence2();
            int N = poly.VertexCount;

            for (int i = 0; i < N; ++i)
            {
                seq.Append(new Segment2d(poly[i], poly[(i + 1) % N]));
            }
            seq.IsClosed = true;
            return(seq);
        }