コード例 #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);
        }
コード例 #2
0
ファイル: CurveUtils2.cs プロジェクト: wyb314/geometry3Sharp
        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);
        }
コード例 #3
0
        public static void Restore(ref ParametricCurveSequence2 sequence, BinaryReader reader)
        {
            sequence.IsClosed = reader.ReadBoolean();
            int N = reader.ReadInt32();

            for (int i = 0; i < N; ++i)
            {
                IParametricCurve2d c;
                Restore(out c, reader);
                sequence.Append(c);
            }
        }