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); }
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); }
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); } }