Ejemplo n.º 1
0
        public static void AddToBounds(Bounds2D bounds, ISegment2DIterator iterator)
        {
            if (!iterator.MoveNext())
            {
                return;
            }
            Point2D[] points  = new Point2D[3];
            Point2D   point2D = new Point2D();

            do
            {
                switch (iterator.Current(points, 0))
                {
                case SegmentType.MoveTo:
                case SegmentType.LineTo:
                    point2D = points[0];
                    bounds.Update(point2D);
                    break;

                case SegmentType.QuadTo:
                    ShapeTool.smethod_4(bounds, point2D, points[0], points[1]);
                    point2D = points[1];
                    bounds.Update(point2D);
                    break;

                case SegmentType.CubicTo:
                    ShapeTool.smethod_5(bounds, point2D, points[0], points[1], points[2]);
                    point2D = points[2];
                    bounds.Update(point2D);
                    break;
                }
            }while (iterator.MoveNext());
        }
Ejemplo n.º 2
0
        public void Append(ISegment2DIterator iterator, bool connect, Matrix4D transform)
        {
            int int2 = this.int_2;

            this.Append(iterator, connect);
            this.method_8(transform, int2, this.int_2);
        }
Ejemplo n.º 3
0
 public Shape2DCollectionIterator(IEnumerable <IShape2D> coll, bool connect)
     : this(connect)
 {
     this.linkedList_0 = new LinkedList <ISegment2DIterator>();
     foreach (IShape2D shape2D in coll)
     {
         ISegment2DIterator iterator = shape2D.CreateIterator();
         this.linkedList_0.AddLast(iterator);
         if (this.int_0 >= 0)
         {
             int totalSegmentCount = iterator.TotalSegmentCount;
             if (totalSegmentCount < 0)
             {
                 this.int_0 = -1;
             }
             else
             {
                 this.int_0 += totalSegmentCount;
             }
         }
         if (this.int_1 >= 0)
         {
             int totalPointCount = iterator.TotalPointCount;
             if (totalPointCount < 0)
             {
                 this.int_1 = -1;
             }
             else
             {
                 this.int_1 += totalPointCount;
             }
         }
     }
 }
Ejemplo n.º 4
0
 public GeneralShape2D(ISegment2DIterator iterator, bool fixate)
     : this(iterator)
 {
     if (!fixate)
     {
         return;
     }
     this.Fixate();
 }
Ejemplo n.º 5
0
        public static void AddShapeToGraphicsPath(
            GraphicsPath path,
            ISegment2DIterator iterator,
            bool connect)
        {
            GeneralShape2D generalShape2D = new GeneralShape2D(iterator, true);

            path.AddPath((GraphicsPath)generalShape2D, connect);
        }
Ejemplo n.º 6
0
        public void CreateShape(
            DxfEntity entity,
            DrawContext.Wireframe drawContext,
            ArgbColor color,
            bool forText,
            IShape4D shape)
        {
            WW.Math.Point2D[] points = new WW.Math.Point2D[3];
            if (shape.IsEmpty)
            {
                return;
            }
            this.textWriter_0.WriteLine("newpath");
            WW.Math.Point2D    point2D  = new WW.Math.Point2D();
            WW.Math.Point2D    p0       = new WW.Math.Point2D();
            ISegment2DIterator iterator = shape.ToShape2D(Matrix4D.Identity).CreateIterator();

            while (iterator.MoveNext())
            {
                switch (iterator.Current(points, 0))
                {
                case SegmentType.MoveTo:
                    WW.Math.Point2D p;
                    p0      = p = points[0];
                    point2D = p;
                    this.method_8(p);
                    continue;

                case SegmentType.LineTo:
                    this.method_9(p0 = points[0]);
                    continue;

                case SegmentType.QuadTo:
                    Pair <WW.Math.Point2D, WW.Math.Point2D> cubicBezier = ShapeTool.QuadToCubicBezier(p0, points[0], points[1]);
                    this.method_10(cubicBezier.First, cubicBezier.Second, p0 = points[1]);
                    continue;

                case SegmentType.CubicTo:
                    this.method_10(points[0], points[1], p0 = points[2]);
                    continue;

                case SegmentType.Close:
                    this.textWriter_0.WriteLine("closepath");
                    p0 = point2D;
                    continue;

                default:
                    continue;
                }
            }
            if (shape.IsFilled)
            {
                this.textWriter_0.WriteLine("fill");
            }
            this.textWriter_0.WriteLine("stroke");
        }
Ejemplo n.º 7
0
 public GeneralShape2D(ISegment2DIterator iterator, Matrix4D transformation, bool fixate)
     : this(iterator)
 {
     this.TransformBy(transformation);
     if (!fixate)
     {
         return;
     }
     this.Fixate();
 }
Ejemplo n.º 8
0
        public GeneralShape2D(ISegment2DIterator iterator)
        {
            int totalPointCount = iterator.TotalPointCount;

            this.point2D_0 = new Point2D[totalPointCount > 0 ? totalPointCount : 16];
            int totalSegmentCount = iterator.TotalSegmentCount;

            this.segmentType_0 = new SegmentType[totalSegmentCount > 0 ? totalSegmentCount : 16];
            this.Append(iterator, false);
        }
Ejemplo n.º 9
0
        private static uint smethod_14(IShape2D shape)
        {
            uint num = 0;
            ISegment2DIterator iterator = shape.CreateIterator();

            while (iterator.MoveNext())
            {
                num = (uint)((byte)(13 * (int)num) + iterator.CurrentType);
            }
            return(num);
        }
Ejemplo n.º 10
0
        private static bool smethod_1(ISegment2DIterator it1, ISegment2DIterator it2)
        {
            int totalPointCount1 = it1.TotalPointCount;
            int totalPointCount2 = it2.TotalPointCount;

            if ((totalPointCount1 < 0 ? 1 : (totalPointCount2 < 0 ? 1 : 0)) == 0 && totalPointCount1 != totalPointCount2)
            {
                return(false);
            }
            int totalSegmentCount1 = it1.TotalSegmentCount;
            int totalSegmentCount2 = it2.TotalSegmentCount;

            if ((totalSegmentCount1 < 0 ? 1 : (totalSegmentCount2 < 0 ? 1 : 0)) == 0 && totalSegmentCount1 != totalSegmentCount2)
            {
                return(false);
            }
            bool flag1;
            bool flag2;

            if ((flag1 = it1.MoveNext()) & (flag2 = it2.MoveNext()))
            {
                Point2D[] points = new Point2D[6];
                do
                {
                    SegmentType segmentType1 = it1.Current(points, 0);
                    SegmentType segmentType2 = it2.Current(points, 3);
                    if (segmentType1 == segmentType2)
                    {
                        for (int index = GeneralShape2D.int_1[(int)segmentType1] - 1; index >= 0; --index)
                        {
                            if (points[index] != points[index + 3])
                            {
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        goto label_12;
                    }
                }while ((flag1 = it1.MoveNext()) & (flag2 = it2.MoveNext()));
                goto label_14;
                label_12:
                return(false);
            }
label_14:
            return(flag1 == flag2);
        }
Ejemplo n.º 11
0
        public static Shape2DCollectionIterator Create <T>(
            IEnumerable <T> coll,
            bool connect)
            where T : IShape2D
        {
            Shape2DCollectionIterator dcollectionIterator = new Shape2DCollectionIterator(false);

            dcollectionIterator.linkedList_0 = new LinkedList <ISegment2DIterator>();
            int num1 = 0;
            int num2 = 0;

            foreach (T obj in coll)
            {
                ISegment2DIterator iterator = obj.CreateIterator();
                dcollectionIterator.linkedList_0.AddLast(iterator);
                if (num1 >= 0)
                {
                    int totalSegmentCount = iterator.TotalSegmentCount;
                    if (totalSegmentCount < 0)
                    {
                        num1 = -1;
                    }
                    else
                    {
                        num1 += totalSegmentCount;
                    }
                }
                if (num2 >= 0)
                {
                    int totalPointCount = iterator.TotalPointCount;
                    if (totalPointCount < 0)
                    {
                        num2 = -1;
                    }
                    else
                    {
                        num2 += totalPointCount;
                    }
                }
            }
            dcollectionIterator.int_0 = num1;
            return(dcollectionIterator);
        }
Ejemplo n.º 12
0
        private static void smethod_10(Stream stream, IShape2D shape)
        {
            Point2D[]          points   = new Point2D[3];
            ISegment2DIterator iterator = shape.CreateIterator();

            while (iterator.MoveNext())
            {
                switch (iterator.Current(points, 0))
                {
                case SegmentType.MoveTo:
                    stream.WriteByte((byte)77);
                    WoutWareFont.smethod_8(stream, points[0]);
                    continue;

                case SegmentType.LineTo:
                    stream.WriteByte((byte)76);
                    WoutWareFont.smethod_8(stream, points[0]);
                    continue;

                case SegmentType.QuadTo:
                    stream.WriteByte((byte)81);
                    WoutWareFont.smethod_8(stream, points[0]);
                    WoutWareFont.smethod_8(stream, points[1]);
                    continue;

                case SegmentType.CubicTo:
                    stream.WriteByte((byte)67);
                    WoutWareFont.smethod_8(stream, points[0]);
                    WoutWareFont.smethod_8(stream, points[1]);
                    WoutWareFont.smethod_8(stream, points[2]);
                    continue;

                case SegmentType.Close:
                    stream.WriteByte((byte)46);
                    continue;

                default:
                    continue;
                }
            }
            stream.WriteByte((byte)33);
        }
Ejemplo n.º 13
0
 public void Append(ISegment2DIterator iterator, bool connect)
 {
     this.method_3();
     while (iterator.MoveNext())
     {
         SegmentType segmentType = iterator.CurrentType;
         if (connect)
         {
             connect     = false;
             segmentType = SegmentType.LineTo;
         }
         if (segmentType == SegmentType.QuadTo)
         {
             ++this.int_4;
         }
         int pointCount = GeneralShape2D.int_1[(int)segmentType];
         this.method_4(pointCount);
         int num = (int)iterator.Current(this.point2D_0, this.int_2);
         this.segmentType_0[this.int_3++] = segmentType;
         this.int_2 += pointCount;
     }
 }
Ejemplo n.º 14
0
        public static void AddToBounds(
            Bounds2D bounds,
            ISegment2DIterator iterator,
            Matrix4D transformation)
        {
            if (!iterator.MoveNext())
            {
                return;
            }
            Point2D[] points  = new Point2D[3];
            Point2D   point2D = new Point2D();

            do
            {
                switch (iterator.Current(points, 0))
                {
                case SegmentType.MoveTo:
                case SegmentType.LineTo:
                    point2D = transformation.Transform(points[0]);
                    bounds.Update(point2D);
                    break;

                case SegmentType.QuadTo:
                    Point2D p1 = transformation.Transform(points[1]);
                    ShapeTool.smethod_4(bounds, point2D, transformation.Transform(points[0]), p1);
                    point2D = p1;
                    bounds.Update(point2D);
                    break;

                case SegmentType.CubicTo:
                    Point2D p3 = transformation.Transform(points[2]);
                    ShapeTool.smethod_5(bounds, point2D, transformation.Transform(points[0]), transformation.Transform(points[1]), p3);
                    point2D = p3;
                    bounds.Update(point2D);
                    break;
                }
            }while (iterator.MoveNext());
        }
Ejemplo n.º 15
0
        internal static string smethod_2(IShape2D shape)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("GeneralShape2D path = new GeneralShape2D();\n");
            Point2D[]          points   = new Point2D[3];
            ISegment2DIterator iterator = shape.CreateIterator();

            while (iterator.MoveNext())
            {
                switch (iterator.Current(points, 0))
                {
                case SegmentType.MoveTo:
                    stringBuilder.Append("path.MoveTo(").Append(ShapeTool.smethod_3(points[0].X)).Append(",").Append(ShapeTool.smethod_3(points[0].Y)).Append(");\n");
                    continue;

                case SegmentType.LineTo:
                    stringBuilder.Append("path.LineTo(").Append(ShapeTool.smethod_3(points[0].X)).Append(",").Append(ShapeTool.smethod_3(points[0].Y)).Append(");\n");
                    continue;

                case SegmentType.QuadTo:
                    stringBuilder.Append("path.QuadTo(").Append(ShapeTool.smethod_3(points[0].X)).Append(",").Append(ShapeTool.smethod_3(points[0].Y)).Append(",").Append(ShapeTool.smethod_3(points[1].X)).Append(",").Append(ShapeTool.smethod_3(points[1].Y)).Append(");\n");
                    continue;

                case SegmentType.CubicTo:
                    stringBuilder.Append("path.CubicTo(").Append(ShapeTool.smethod_3(points[0].X)).Append(",").Append(ShapeTool.smethod_3(points[0].Y)).Append(",").Append(ShapeTool.smethod_3(points[1].X)).Append(",").Append(ShapeTool.smethod_3(points[1].Y)).Append(",").Append(ShapeTool.smethod_3(points[2].X)).Append(",").Append(ShapeTool.smethod_3(points[2].Y)).Append(");\n");
                    continue;

                case SegmentType.Close:
                    stringBuilder.Append("path.Close();\n");
                    continue;

                default:
                    continue;
                }
            }
            return(stringBuilder.ToString());
        }
Ejemplo n.º 16
0
            public void CreateShape(DxfEntity entity, IShape4D shape)
            {
                if (shape.IsEmpty)
                {
                    return;
                }
                WW.Math.Point2D[]  points    = new WW.Math.Point2D[3];
                List <bool>        boolList  = new List <bool>();
                ISegment2DIterator iterator1 = shape.CreateIterator(this.matrix4D_0);

                while (iterator1.MoveNext())
                {
                    switch (iterator1.CurrentType)
                    {
                    case SegmentType.MoveTo:
                        boolList.Add(false);
                        continue;

                    case SegmentType.Close:
                        boolList[boolList.Count - 1] = true;
                        continue;

                    default:
                        continue;
                    }
                }
                int num = 0;
                List <System.Windows.Point> pointList = new List <System.Windows.Point>();
                ISegment2DIterator          iterator2 = shape.CreateIterator(this.matrix4D_0);

                while (iterator2.MoveNext())
                {
                    switch (iterator2.Current(points, 0))
                    {
                    case SegmentType.MoveTo:
                        this.class453_0.method_1((System.Windows.Point)points[0], this.class453_0.Fill, boolList[num++]);
                        continue;

                    case SegmentType.LineTo:
                        this.class453_0.method_4((System.Windows.Point)points[0]);
                        continue;

                    case SegmentType.QuadTo:
                        pointList.Clear();
                        pointList.Add((System.Windows.Point)points[0]);
                        pointList.Add((System.Windows.Point)points[1]);
                        this.class453_0.method_6((IList <System.Windows.Point>)pointList);
                        continue;

                    case SegmentType.CubicTo:
                        pointList.Clear();
                        pointList.Add((System.Windows.Point)points[0]);
                        pointList.Add((System.Windows.Point)points[1]);
                        pointList.Add((System.Windows.Point)points[2]);
                        this.class453_0.method_8((IList <System.Windows.Point>)pointList);
                        continue;

                    default:
                        continue;
                    }
                }
            }
Ejemplo n.º 17
0
            private bool method_5(IShape4D shape)
            {
                if (shape.IsEmpty)
                {
                    return(false);
                }
                StringBuilder stringBuilder = this.stack_0.Peek().StringBuilder;

                WW.Math.Point2D[]  points      = new WW.Math.Point2D[3];
                SegmentType        segmentType = SegmentType.MoveTo;
                ISegment2DIterator iterator    = shape.CreateIterator(this.xamlExporter_0.matrix4D_0);

                while (iterator.MoveNext())
                {
                    switch (iterator.Current(points, 0))
                    {
                    case SegmentType.MoveTo:
                        stringBuilder.Append('M');
                        stringBuilder.Append(points[0].X.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(',');
                        stringBuilder.Append(points[0].Y.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        segmentType = SegmentType.MoveTo;
                        break;

                    case SegmentType.LineTo:
                        if (segmentType != SegmentType.LineTo)
                        {
                            stringBuilder.Append('L');
                        }
                        stringBuilder.Append(points[0].X.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(',');
                        stringBuilder.Append(points[0].Y.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        segmentType = SegmentType.LineTo;
                        break;

                    case SegmentType.QuadTo:
                        if (segmentType != SegmentType.QuadTo)
                        {
                            stringBuilder.Append('Q');
                        }
                        stringBuilder.Append(points[0].X.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(',');
                        stringBuilder.Append(points[0].Y.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(' ');
                        stringBuilder.Append(points[1].X.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(',');
                        stringBuilder.Append(points[1].Y.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        segmentType = SegmentType.QuadTo;
                        break;

                    case SegmentType.CubicTo:
                        if (segmentType != SegmentType.CubicTo)
                        {
                            stringBuilder.Append('C');
                        }
                        stringBuilder.Append(points[0].X.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(',');
                        stringBuilder.Append(points[0].Y.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(' ');
                        stringBuilder.Append(points[1].X.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(',');
                        stringBuilder.Append(points[1].Y.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(' ');
                        stringBuilder.Append(points[2].X.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        stringBuilder.Append(',');
                        stringBuilder.Append(points[2].Y.ToString(this.xamlExporter_0.string_2, (IFormatProvider)CultureInfo.InvariantCulture));
                        segmentType = SegmentType.CubicTo;
                        break;

                    case SegmentType.Close:
                        stringBuilder.Append('Z');
                        segmentType = SegmentType.Close;
                        break;
                    }
                    stringBuilder.Append(' ');
                }
                return(true);
            }
Ejemplo n.º 18
0
        public static Matrix3D?GetTransformation(
            IShape2D shape1,
            IShape2D shape2,
            double accuracy)
        {
            if (!shape1.HasSegments || !shape2.HasSegments)
            {
                return(new Matrix3D?());
            }
            ISegment2DIterator iterator1 = shape1.CreateIterator();
            ISegment2DIterator iterator2 = shape2.CreateIterator();

            if (iterator1.TotalPointCount != iterator2.TotalPointCount || iterator1.TotalSegmentCount != iterator2.TotalSegmentCount)
            {
                return(new Matrix3D?());
            }
            if (iterator1.MoveNext() && iterator2.MoveNext())
            {
                Point2D[] point2DArray1 = new Point2D[iterator1.TotalPointCount];
                Point2D[] point2DArray2 = new Point2D[iterator2.TotalPointCount];
                double    num1          = accuracy * accuracy;
                if (iterator1.Current(point2DArray1, 0) == iterator2.Current(point2DArray2, 0))
                {
                    Matrix3D?nullable = new Matrix3D?();
                    int      offset   = 1;
                    if (!iterator1.MoveNext() || !iterator2.MoveNext())
                    {
                        return(new Matrix3D?(Transformation3D.Translation(point2DArray2[0] - point2DArray1[0])));
                    }
                    do
                    {
                        int         num2         = offset;
                        SegmentType segmentType1 = iterator1.Current(point2DArray1, offset);
                        SegmentType segmentType2 = iterator2.Current(point2DArray2, offset);
                        if (segmentType1 == segmentType2)
                        {
                            offset += GeneralShape2D.int_1[(int)segmentType1];
                            if (!nullable.HasValue && offset >= 3)
                            {
                                nullable = ShapeTool.smethod_0(point2DArray1, point2DArray2);
                                num2     = 3;
                            }
                            if (nullable.HasValue)
                            {
                                int index = num2;
                                while (true)
                                {
                                    if (index < offset)
                                    {
                                        if ((nullable.Value.Transform(point2DArray1[index]) - point2DArray2[index]).GetLengthSquared() <= num1)
                                        {
                                            ++index;
                                        }
                                        else
                                        {
                                            goto label_15;
                                        }
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                        else
                        {
                            goto label_14;
                        }
                    }while (iterator1.MoveNext() && iterator2.MoveNext());
                    goto label_16;
label_14:
                    return(new Matrix3D?());

label_15:
                    return(new Matrix3D?());

label_16:
                    return(nullable);
                }
            }
            return(new Matrix3D?());
        }
Ejemplo n.º 19
0
 public GeneralShape2D(ISegment2DIterator iterator, Matrix4D transformation)
     : this(iterator, transformation, false)
 {
 }
Ejemplo n.º 20
0
 public TransformingSegment2DIterator(ISegment2DIterator iterator, Matrix4D transformation)
 {
     this.isegment2DIterator_0 = iterator;
     this.matrix4D_0           = transformation;
 }
Ejemplo n.º 21
0
        public static Polyline2DCollection GetFlattened(
            IShape2D shape,
            double epsilon)
        {
            if (epsilon == 0.0)
            {
                epsilon = -0.01;
            }
            Polyline2DCollection polyline2Dcollection = new Polyline2DCollection();

            if (epsilon < 0.0)
            {
                Bounds2D bounds = ShapeTool.GetBounds(shape);
                if (!bounds.Initialized)
                {
                    return(polyline2Dcollection);
                }
                epsilon *= -System.Math.Max(bounds.Delta.X, bounds.Delta.Y);
            }
            epsilon *= epsilon;
            ISegment2DIterator iterator = shape.CreateIterator();

            if (iterator.MoveNext())
            {
                Point2D[]  points   = new Point2D[3];
                Polyline2D polyline = (Polyline2D)null;
                do
                {
                    switch (iterator.Current(points, 0))
                    {
                    case SegmentType.MoveTo:
                        polyline = new Polyline2D();
                        polyline2Dcollection.Add(polyline);
                        polyline.Add(points[0]);
                        break;

                    case SegmentType.LineTo:
                        polyline.Add(points[0]);
                        break;

                    case SegmentType.QuadTo:
                        ShapeTool.smethod_7(polyline, polyline[polyline.Count - 1], points[0], points[1], epsilon);
                        break;

                    case SegmentType.CubicTo:
                        ShapeTool.smethod_11(polyline, polyline[polyline.Count - 1], points[0], points[1], points[2], epsilon);
                        break;

                    case SegmentType.Close:
                        polyline.Closed = true;
                        if (polyline.Count > 1 && polyline[polyline.Count - 1] == polyline[0])
                        {
                            polyline.RemoveAt(polyline.Count - 1);
                            break;
                        }
                        break;
                    }
                }while (iterator.MoveNext());
            }
            return(polyline2Dcollection);
        }
Ejemplo n.º 22
0
        public static List <Polyline4D> GetFlattened(
            ITransformer4D transformation,
            IShape2D shape,
            double epsilon)
        {
            if (epsilon == 0.0)
            {
                epsilon = -0.01;
            }
            List <Polyline4D> polyline4DList = new List <Polyline4D>();

            if (epsilon < 0.0)
            {
                Bounds2D bounds = ShapeTool.GetBounds(shape);
                if (!bounds.Initialized)
                {
                    return(polyline4DList);
                }
                epsilon *= -System.Math.Max(bounds.Delta.X, bounds.Delta.Y);
            }
            epsilon *= epsilon;
            ISegment2DIterator iterator = shape.CreateIterator();

            if (iterator.MoveNext())
            {
                Point2D[]  points   = new Point2D[3];
                Polyline4D polyline = (Polyline4D)null;
                Point2D    p0       = new Point2D();
                do
                {
                    switch (iterator.Current(points, 0))
                    {
                    case SegmentType.MoveTo:
                        polyline = new Polyline4D();
                        polyline4DList.Add(polyline);
                        polyline.Add(transformation.TransformTo4D(points[0]));
                        p0 = points[0];
                        break;

                    case SegmentType.LineTo:
                        polyline.Add(transformation.TransformTo4D(points[0]));
                        p0 = points[0];
                        break;

                    case SegmentType.QuadTo:
                        ShapeTool.smethod_8(polyline, transformation, p0, points[0], points[1], epsilon);
                        p0 = points[1];
                        break;

                    case SegmentType.CubicTo:
                        ShapeTool.smethod_12(polyline, transformation, p0, points[0], points[1], points[2], epsilon);
                        p0 = points[2];
                        break;

                    case SegmentType.Close:
                        polyline.Closed = true;
                        if (polyline.Count > 1 && polyline[polyline.Count - 1] == polyline[0])
                        {
                            polyline.RemoveAt(polyline.Count - 1);
                            break;
                        }
                        break;
                    }
                }while (iterator.MoveNext());
            }
            return(polyline4DList);
        }