Example #1
0
        private void method_0(
            Polyline4D result,
            double startParam,
            double endParam,
            Class455.Class462 polylineInfo)
        {
            Polyline3D polyline3D0 = polylineInfo.polyline3D_0;
            int        count       = polyline3D0.Count;
            int        num1        = (int)System.Math.Floor(startParam);
            double     parameter1  = startParam - (double)num1;
            int        num2        = (int)System.Math.Floor(endParam);
            double     parameter2  = endParam - (double)num2;

            if (startParam > endParam)
            {
                num2 += count;
            }
            result.Add(this.matrix4D_0.TransformTo4D(Class455.smethod_0(polyline3D0[num1 % count], polyline3D0[(num1 + 1) % count], parameter1)));
            for (int index = num1 + 1; index <= num2; ++index)
            {
                result.Add(this.matrix4D_0.TransformTo4D(polyline3D0[index % count]));
            }
            if (parameter2 <= 0.0)
            {
                return;
            }
            result.Add(this.matrix4D_0.TransformTo4D(Class455.smethod_0(polyline3D0[num2 % count], polyline3D0[(num2 + 1) % count], parameter2)));
        }
Example #2
0
        public void DrawPath(
            IShape2D path,
            Matrix4D transform,
            Color color,
            short lineWeight,
            bool filled,
            bool forText,
            double extrusion)
        {
            if (!path.HasSegments)
            {
                return;
            }
            IClippingTransformer transformer = (IClippingTransformer)this.wireframe_0.GetTransformer().Clone();

            transformer.SetPreTransform(transform);
            if (extrusion == 0.0)
            {
                IShape4D shape1 = (IShape4D) new FlatShape4D(path, filled);
                IShape4D shape2 = transformer.Transform(shape1);
                if (shape2.IsEmpty)
                {
                    return;
                }
                this.iwireframeGraphicsFactory2_0.BeginGeometry(this.dxfEntity_0, this.wireframe_0, this.wireframe_0.GetPlotColor(this.dxfEntity_0, color), false, filled, !filled, true);
                this.iwireframeGraphicsFactory2_0.CreateShape(this.dxfEntity_0, shape2);
                this.iwireframeGraphicsFactory2_0.EndGeometry();
            }
            else
            {
                IList <Polyline2D> flattened  = (IList <Polyline2D>)ShapeTool.GetFlattened(path, this.wireframe_0.Config.ShapeFlattenEpsilon);
                IList <Polyline4D> polylines1 = DxfUtil.smethod_39(flattened, filled, transformer);
                ArgbColor          plotColor  = this.wireframe_0.GetPlotColor(this.dxfEntity_0, color);
                Class940.smethod_3(this.dxfEntity_0, this.wireframe_0, this.iwireframeGraphicsFactory2_0, plotColor, forText, false, true, polylines1);
                transformer.SetPreTransform(Transformation4D.Translation(0.0, 0.0, extrusion));
                IList <Polyline4D> polylines2 = DxfUtil.smethod_39(flattened, filled, transformer);
                Class940.smethod_3(this.dxfEntity_0, this.wireframe_0, this.iwireframeGraphicsFactory2_0, plotColor, forText, false, true, polylines2);
                Polyline4D polyline4D1 = new Polyline4D(2);
                polyline4D1.Add(Vector4D.Zero);
                polyline4D1.Add(Vector4D.Zero);
                IList <Polyline4D> polylines3 = (IList <Polyline4D>) new List <Polyline4D>(1);
                polylines3.Add(polyline4D1);
                for (int index1 = polylines1.Count - 1; index1 >= 0; --index1)
                {
                    Polyline4D polyline4D2 = polylines1[index1];
                    Polyline4D polyline4D3 = polylines2[index1];
                    for (int index2 = polyline4D2.Count - 1; index2 >= 0; --index2)
                    {
                        polyline4D1[0] = polyline4D2[index2];
                        polyline4D1[1] = polyline4D3[index2];
                        Class940.smethod_2(this.dxfEntity_0, this.wireframe_0, this.iwireframeGraphicsFactory2_0, plotColor, forText, false, true, polylines3);
                    }
                }
            }
        }
        public IList <Polyline4D> Transform(Polyline3D polyline, bool filled)
        {
            Polyline4D polyline1 = new Polyline4D(polyline.Count, polyline.Closed);

            foreach (Point3D point3D in (List <Point3D>)polyline)
            {
                polyline1.Add((Vector4D)point3D);
            }
            return(ModelSpaceClippingTransformer.GetTransformed(this.interface32_0.Clip(polyline1, filled), this.matrix4D_0));
        }
Example #4
0
        private void method_1(
            Polyline4D result,
            Class455.Class456 start,
            Class455.Class456 end,
            bool backward,
            Class455.Class462 polylineInfo)
        {
            Polyline3D polyline3D0 = polylineInfo.polyline3D_0;
            Polygon2D  polygon2D0  = this.class461_0.polygon2D_0;
            int        count       = polygon2D0.Count;
            double     double0_1   = start.double_0;
            double     double0_2   = end.double_0;
            double     double1_1   = start.double_1;
            double     double1_2   = end.double_1;
            int        num1        = (int)System.Math.Floor(double0_1) % count;
            int        num2        = (int)System.Math.Floor(double0_2) % count;

            result.Add(this.matrix4D_0.TransformTo4D(Class455.smethod_1(polyline3D0, double1_1)));
            if (backward)
            {
                for (int index = num1; index != num2; index = (index + count - 1) % count)
                {
                    Point2D p     = polygon2D0[index];
                    Point3D point = new Point3D(p.X, p.Y, polylineInfo.method_3(p));
                    result.Add(this.matrix4D_0.TransformTo4D(point));
                }
            }
            else
            {
                for (int index = num1; index != num2; index = (index + 1) % count)
                {
                    Point2D p     = polygon2D0[index];
                    Point3D point = new Point3D(p.X, p.Y, polylineInfo.method_3(p));
                    result.Add(this.matrix4D_0.TransformTo4D(point));
                }
            }
            if (double0_2 == System.Math.Floor(double0_2))
            {
                return;
            }
            result.Add(this.matrix4D_0.TransformTo4D(Class455.smethod_1(polyline3D0, double1_2)));
        }
Example #5
0
        public IList <Polyline4D> Transform(Polyline3D polyline, bool filled)
        {
            Polyline4D polyline4D = new Polyline4D(polyline.Count, polyline.Closed);

            for (int index = 0; index < polyline.Count; ++index)
            {
                polyline4D.Add(this.matrix4D_0.TransformTo4D(polyline[index]));
            }
            return((IList <Polyline4D>) new Polyline4D[1] {
                polyline4D
            });
        }
Example #6
0
        internal static void smethod_8(
            DxfEntity entity,
            DrawContext.Surface context,
            ISurfaceGraphicsFactory graphicsFactory,
            WW.Cad.Drawing.Polyline2D2N polylineA,
            WW.Cad.Drawing.Polyline2D2N polylineB,
            bool isSurface,
            Matrix4D transform,
            Vector3D normal,
            double extrusion)
        {
            Interface41 transformer = (Interface41)context.GetTransformer().Clone();

            transformer.SetPreTransform(transform);
            Vector3D vector3D  = transformer.Transform(new Vector3D(0.0, 0.0, extrusion));
            Vector4D vector4D1 = (Vector4D)vector3D;

            if (polylineA.Count == 1)
            {
                Point2D2N point2D2N1 = polylineA[0];
                Point2D2N point2D2N2 = polylineB[0];
                if (point2D2N1.Position == point2D2N2.Position)
                {
                    Vector4D start = transformer.Transform((WW.Math.Point3D)point2D2N1.Position);
                    graphicsFactory.CreateSegment(start, start + vector4D1);
                }
                else
                {
                    Vector4D   vector4D2     = transformer.Transform(point2D2N1.Position);
                    Vector4D   vector4D3     = transformer.Transform(point2D2N2.Position);
                    Vector4D[] vector4DArray = new Vector4D[4] {
                        vector4D2, vector4D3, vector4D3 + vector4D1, vector4D2 + vector4D1
                    };
                    if (isSurface)
                    {
                        graphicsFactory.CreateQuad((IList <Vector4D>)vector4DArray, (IList <bool>)null);
                    }
                    else
                    {
                        graphicsFactory.CreatePolyline((IList <Vector4D>)vector4DArray, true);
                    }
                }
            }
            else if (polylineA.Count == 2)
            {
                Point2D2N  point2D2N1     = polylineA[0];
                Point2D2N  point2D2N2     = polylineA[1];
                Point2D2N  point2D2N3     = polylineB[0];
                Point2D2N  point2D2N4     = polylineB[1];
                Vector4D   vector4D2      = transformer.Transform(new WW.Math.Point3D(point2D2N1.Position, 0.0));
                Vector4D   vector4D3      = transformer.Transform(new WW.Math.Point3D(point2D2N2.Position, 0.0));
                Vector4D   vector4D4      = transformer.Transform(new WW.Math.Point3D(point2D2N3.Position, 0.0));
                Vector4D   vector4D5      = transformer.Transform(new WW.Math.Point3D(point2D2N4.Position, 0.0));
                Vector4D   vector4D6      = vector4D2 + vector4D1;
                Vector4D   vector4D7      = vector4D3 + vector4D1;
                Vector4D   vector4D8      = vector4D4 + vector4D1;
                Vector4D   vector4D9      = vector4D5 + vector4D1;
                Vector4D[] vector4DArray1 = new Vector4D[4] {
                    vector4D2, vector4D3, vector4D5, vector4D4
                };
                Vector4D[] vector4DArray2 = new Vector4D[4] {
                    vector4D6, vector4D7, vector4D9, vector4D8
                };
                if (isSurface)
                {
                    graphicsFactory.CreateQuad((IList <Vector4D>)vector4DArray1, (IList <bool>)null);
                    graphicsFactory.CreateQuad((IList <Vector4D>)vector4DArray2, (IList <bool>)null);
                    graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4]
                    {
                        vector4D2,
                        vector4D4,
                        vector4D8,
                        vector4D6
                    }, (IList <bool>)null);
                    graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4]
                    {
                        vector4D3,
                        vector4D5,
                        vector4D9,
                        vector4D7
                    }, (IList <bool>)null);
                    graphicsFactory.CreateQuadStrip((IList <Vector4D>) new Vector4D[2]
                    {
                        vector4D2,
                        vector4D3
                    }, (IList <Vector4D>) new Vector4D[2]
                    {
                        vector4D6,
                        vector4D7
                    }, (IList <Vector3D>) new Vector3D[2]
                    {
                        transformer.Transform(new Vector3D(point2D2N1.StartNormal, 0.0)),
                        transformer.Transform(new Vector3D(point2D2N1.EndNormal, 0.0))
                    }, 0, 1);
                    graphicsFactory.CreateQuadStrip((IList <Vector4D>) new Vector4D[2]
                    {
                        vector4D8,
                        vector4D9
                    }, (IList <Vector4D>) new Vector4D[2]
                    {
                        vector4D4,
                        vector4D5
                    }, (IList <Vector3D>) new Vector3D[2]
                    {
                        transformer.Transform(new Vector3D(point2D2N3.StartNormal, 0.0)),
                        transformer.Transform(new Vector3D(point2D2N3.EndNormal, 0.0))
                    }, 0, 1);
                }
                else
                {
                    graphicsFactory.CreatePolyline((IList <Vector4D>)vector4DArray1, true);
                    graphicsFactory.CreatePolyline((IList <Vector4D>)vector4DArray2, true);
                    for (int index = 0; index < 4; ++index)
                    {
                        graphicsFactory.CreateSegment(vector4DArray1[index], vector4DArray2[index]);
                    }
                }
            }
            else
            {
                int        count             = polylineA.Count;
                int        index1            = count - 1;
                bool       closed            = polylineA.Closed;
                Polyline4D polyline4DBottom1 = DxfUtil.smethod_47(polylineA, transformer);
                Polyline4D polyline4DTop1    = DxfUtil.smethod_47(polylineB, transformer);
                Polyline4D polyline4DTop2    = new Polyline4D(count, closed);
                Polyline4D polyline4DBottom2 = new Polyline4D(count, closed);
                for (int index2 = 0; index2 < count; ++index2)
                {
                    polyline4DTop2.Add(polyline4DBottom1[index2] + vector3D);
                    polyline4DBottom2.Add(polyline4DTop1[index2] + vector3D);
                }
                if (isSurface)
                {
                    graphicsFactory.CreateQuadStrip((IList <Vector4D>)polyline4DBottom1, (IList <Vector4D>)polyline4DTop1, normal, closed);
                    graphicsFactory.CreateQuadStrip((IList <Vector4D>)polyline4DTop2, (IList <Vector4D>)polyline4DBottom2, normal, closed);
                    if (!closed)
                    {
                        graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4]
                        {
                            polyline4DBottom1[0],
                            polyline4DTop2[0],
                            polyline4DBottom2[0],
                            polyline4DTop1[0]
                        }, (IList <bool>)null);
                        graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4]
                        {
                            polyline4DBottom1[index1],
                            polyline4DTop2[index1],
                            polyline4DBottom2[index1],
                            polyline4DTop1[index1]
                        }, (IList <bool>)null);
                    }
                    Class940.smethod_9(entity, graphicsFactory, polylineA, transformer, polyline4DBottom1, polyline4DTop2);
                    Class940.smethod_9(entity, graphicsFactory, polylineB, transformer, polyline4DBottom2, polyline4DTop1);
                    if (closed)
                    {
                        return;
                    }
                    Vector4D vector4D2 = polyline4DBottom1[0];
                    Vector4D vector4D3 = polyline4DTop1[0];
                    Vector4D vector4D4 = polyline4DTop2[0];
                    Vector4D vector4D5 = polyline4DBottom2[0];
                    graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4]
                    {
                        vector4D2,
                        vector4D3,
                        vector4D5,
                        vector4D4
                    }, (IList <bool>)null);
                    int      index2    = count - 1;
                    Vector4D vector4D6 = polyline4DBottom1[index2];
                    Vector4D vector4D7 = polyline4DTop1[index2];
                    Vector4D vector4D8 = polyline4DTop2[index2];
                    Vector4D vector4D9 = polyline4DBottom2[index2];
                    graphicsFactory.CreateQuad((IList <Vector4D>) new Vector4D[4]
                    {
                        vector4D6,
                        vector4D7,
                        vector4D9,
                        vector4D8
                    }, (IList <bool>)null);
                }
                else
                {
                    int index2 = 0;
                    int num    = 1;
                    if (closed)
                    {
                        index2 = count - 1;
                        num    = 0;
                    }
                    Vector4D start     = polyline4DBottom1[index2];
                    Vector4D vector4D2 = polyline4DTop1[index2];
                    Vector4D vector4D3 = polyline4DTop2[index2];
                    Vector4D end       = polyline4DBottom2[index2];
                    for (int index3 = num; index3 < count; ++index3)
                    {
                        Vector4D vector4D4 = polyline4DBottom1[index3];
                        Vector4D vector4D5 = polyline4DTop1[index3];
                        Vector4D vector4D6 = polyline4DTop2[index3];
                        Vector4D vector4D7 = polyline4DBottom2[index3];
                        graphicsFactory.CreateSegment(start, vector4D2);
                        graphicsFactory.CreateSegment(vector4D3, end);
                        graphicsFactory.CreateSegment(start, vector4D3);
                        graphicsFactory.CreateSegment(vector4D2, end);
                        start     = vector4D4;
                        vector4D2 = vector4D5;
                        vector4D3 = vector4D6;
                        end       = vector4D7;
                    }
                    graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DBottom1, closed);
                    graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DTop1, closed);
                    graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DTop2, closed);
                    graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DBottom2, closed);
                }
            }
        }
Example #7
0
        internal static void smethod_6(
            DxfEntity entity,
            DrawContext.Surface context,
            ISurfaceGraphicsFactory graphicsFactory,
            WW.Cad.Drawing.Polyline2D2N polyline,
            bool isSurface,
            Matrix4D transform,
            Vector3D normal,
            double extrusion)
        {
            Interface41 transformer = (Interface41)context.GetTransformer().Clone();

            transformer.SetPreTransform(transform);
            Vector3D vector3D  = transformer.Transform(new Vector3D(0.0, 0.0, extrusion));
            Vector4D vector4D1 = (Vector4D)vector3D;

            if (polyline.Count == 1)
            {
                Point2D2N point2D2N = polyline[0];
                Vector4D  start     = transformer.Transform(point2D2N.Position);
                graphicsFactory.CreateSegment(start, start + vector4D1);
            }
            else if (polyline.Count == 2)
            {
                Point2D2N point2D2N1 = polyline[0];
                Point2D2N point2D2N2 = polyline[1];
                Vector4D  vector4D2  = transformer.Transform(point2D2N1.Position);
                Vector4D  vector4D3  = transformer.Transform(point2D2N2.Position);
                Vector4D  vector4D4  = vector4D2 + vector4D1;
                Vector4D  vector4D5  = vector4D3 + vector4D1;
                if (isSurface)
                {
                    graphicsFactory.CreateQuadStrip((IList <Vector4D>) new Vector4D[2]
                    {
                        vector4D2,
                        vector4D3
                    }, (IList <Vector4D>) new Vector4D[2]
                    {
                        vector4D4,
                        vector4D5
                    }, (IList <Vector3D>) new Vector3D[2]
                    {
                        transformer.Transform(new Vector3D(point2D2N1.StartNormal, 0.0)),
                        transformer.Transform(new Vector3D(point2D2N1.EndNormal, 0.0))
                    }, 0, 1);
                }
                else
                {
                    graphicsFactory.CreatePolyline((IList <Vector4D>) new Vector4D[4]
                    {
                        vector4D2,
                        vector4D3,
                        vector4D5,
                        vector4D4
                    }, true);
                }
            }
            else
            {
                int        count            = polyline.Count;
                bool       closed           = polyline.Closed;
                Polyline4D polyline4DBottom = DxfUtil.smethod_47(polyline, transformer);
                Polyline4D polyline4DTop    = new Polyline4D(count, closed);
                for (int index = 0; index < count; ++index)
                {
                    polyline4DTop.Add(polyline4DBottom[index] + vector3D);
                }
                if (isSurface)
                {
                    Class940.smethod_9(entity, graphicsFactory, polyline, transformer, polyline4DBottom, polyline4DTop);
                }
                else
                {
                    for (int index = 0; index < count; ++index)
                    {
                        Vector4D start = polyline4DBottom[index];
                        Vector4D end   = polyline4DTop[index];
                        graphicsFactory.CreateSegment(start, end);
                    }
                    graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DBottom, closed);
                    graphicsFactory.CreatePolyline((IList <Vector4D>)polyline4DTop, closed);
                }
            }
        }
Example #8
0
        public override IList <Polyline4D> Clip(Polyline4D polyline, bool filled)
        {
            int count = polyline.Count;

            switch (count)
            {
            case 0:
                return(AbstractClipperBase4D.PolylinesClippedAway);

            case 1:
                if (!Class455.Contains(this.class461_0, this.matrix4D_1.TransformToPoint2D(polyline[0])))
                {
                    return(AbstractClipperBase4D.PolylinesClippedAway);
                }
                return((IList <Polyline4D>) new Polyline4D[1] {
                    polyline
                });

            default:
                Polyline3D polyline1 = new Polyline3D(polyline.Count, polyline.Closed);
                foreach (Vector4D vector in (List <Vector4D>)polyline)
                {
                    polyline1.Add(this.matrix4D_1.TransformToPoint3D(vector));
                }
                Class455.Class462        polylineInfo = new Class455.Class462(polyline1);
                List <Class455.Class456> class456List = this.class461_0.method_0((Class455.Class460)polylineInfo);
                if (class456List.Count == 0)
                {
                    if (polyline1.Count == 0)
                    {
                        return (IList <Polyline4D>) new Polyline4D[1] {
                                   polyline
                        }
                    }
                    ;
                    foreach (Point3D point3D in (List <Point3D>)polyline1)
                    {
                        if (Class455.Contains(this.class461_0, (Point2D)point3D))
                        {
                            return (IList <Polyline4D>) new Polyline4D[1] {
                                       polyline
                            }
                        }
                        ;
                    }
                    if (!filled || polyline.Count < 3)
                    {
                        return(AbstractClipperBase4D.PolylinesClippedAway);
                    }
                    Polygon2D polygon2D = new Polygon2D(polyline1.Count);
                    foreach (Point3D point3D in (List <Point3D>)polyline1)
                    {
                        polygon2D.Add((Point2D)point3D);
                    }
                    bool flag = false;
                    foreach (Point2D p in (List <Point2D>) this.class461_0.polygon2D_0)
                    {
                        if (polygon2D.IsInside(p))
                        {
                            flag = true;

                            break;
                        }
                    }
                    if (filled && flag)
                    {
                        Plane3D?plane = Polygon3D.GetPlane((IList <Point3D>)polyline1);
                        if (plane.HasValue)
                        {
                            Plane3D    plane3D    = plane.Value;
                            Polyline4D polyline4D = new Polyline4D(this.class461_0.polygon2D_0.Count, true);
                            foreach (Point2D point2D in (List <Point2D>) this.class461_0.polygon2D_0)
                            {
                                Point3D?intersection = plane3D.GetIntersection(new Ray3D(point2D.X, point2D.Y, 0.0, 0.0, 0.0, 1.0));
                                if (intersection.HasValue)
                                {
                                    polyline4D.Add(this.matrix4D_0.TransformTo4D(intersection.Value));
                                }
                                else
                                {
                                    intersection = plane3D.GetIntersection(new Ray3D(point2D.X, point2D.Y, 0.0, 0.0, 0.0, -1.0));
                                    if (intersection.HasValue)
                                    {
                                        polyline4D.Add(this.matrix4D_0.TransformTo4D(intersection.Value));
                                    }
                                }
                            }
                            return((IList <Polyline4D>) new Polyline4D[1] {
                                polyline4D
                            });
                        }
                    }
                    return(AbstractClipperBase4D.PolylinesClippedAway);
                }
                bool flag1 = polylineInfo.double_0 * this.class461_0.double_0 >= 0.0;
                List <Polyline4D> polyline4DList = new List <Polyline4D>();
                int index1;
                if (!Class455.Contains(this.class461_0, (Point2D)polyline1[0]))
                {
                    index1 = 0;
                }
                else if (polyline.Closed)
                {
                    index1 = class456List.Count - 1;
                }
                else
                {
                    Polyline4D result = new Polyline4D(filled);
                    this.method_0(result, 0.0, class456List[0].double_1, polylineInfo);
                    polyline4DList.Add(result);
                    class456List.RemoveAt(0);
                    index1 = 0;
                    if (class456List.Count == 0)
                    {
                        return((IList <Polyline4D>)polyline4DList);
                    }
                }
                if (filled)
                {
                    while (class456List.Count > 0)
                    {
                        if (polylineInfo.bool_0)
                        {
                            class456List.Sort(new Comparison <Class455.Class456>(Class455.Class456.smethod_2));
                        }
                        else
                        {
                            class456List.Sort(new Comparison <Class455.Class456>(Class455.Class456.smethod_0));
                            if (!flag1)
                            {
                                class456List.Reverse();
                            }
                        }
                        for (int index2 = 0; index2 < class456List.Count; ++index2)
                        {
                            Class455.Class456 class456_1 = class456List[index2];
                            Class455.Class456 class456_2 = class456List[(index2 + 1) % class456List.Count];
                            class456_1.class456_0 = class456_2;
                            class456_2.class456_1 = class456_1;
                        }
                        class456List.Sort(new Comparison <Class455.Class456>(Class455.Class456.smethod_1));
                        for (int index2 = 0; index2 < class456List.Count; ++index2)
                        {
                            Class455.Class456 class456_1 = class456List[index2];
                            Class455.Class456 class456_2 = class456List[(index2 + 1) % class456List.Count];
                            class456_1.class456_2 = class456_2;
                            class456_2.class456_3 = class456_1;
                        }
                        Polyline4D result = new Polyline4D(true);
                        polyline4DList.Add(result);
                        Class455.Class456 class456 = class456List[index1];
                        class456List.RemoveAt(index1);
                        bool flag2 = index1 > 0;
                        index1 = 0;
                        Class455.Class456 start = class456;
                        do
                        {
                            Class455.Class456 end = start.class456_2;
                            bool flag3;
                            if (flag2 || end.double_1 >= start.double_1)
                            {
                                double parameter = 0.5 * (start.double_1 + end.double_1);
                                if (flag2)
                                {
                                    parameter += 0.5 * (double)count;
                                    flag2      = false;
                                }
                                flag3 = Class455.Contains(this.class461_0, (Point2D)Class455.smethod_1(polylineInfo.polyline3D_0, parameter));
                            }
                            else
                            {
                                goto label_72;
                            }
label_65:
                            if (flag3)
                            {
                                this.method_0(result, start.double_1, end.double_1, polylineInfo);
                            }
                            else
                            {
                                end = start.class456_0;
                                if (polylineInfo.bool_0)
                                {
                                    result.Add(this.matrix4D_0.TransformTo4D(Class455.smethod_1(polylineInfo.polyline3D_0, start.double_1)));
                                }
                                else
                                {
                                    this.method_1(result, start, end, !flag1, polylineInfo);
                                }
                            }
                            class456List.Remove(end);
                            if (end.class456_2 != end.class456_3)
                            {
                                end.class456_1.class456_0 = end.class456_0;
                                end.class456_0.class456_1 = end.class456_1;
                                end.class456_3.class456_2 = end.class456_2;
                                end.class456_2.class456_3 = end.class456_3;
                                start = end;
                                continue;
                            }
                            break;
label_72:
                            flag3 = false;
                            goto label_65;
                        }while (!object.ReferenceEquals((object)start, (object)class456));
                        if (result.Count < 3)
                        {
                            result.Closed = false;
                        }
                    }
                }
                else
                {
                    bool flag2 = Class455.Contains(this.class461_0, (Point2D)polyline1[polyline1.Count - 1]);
                    class456List.Sort(new Comparison <Class455.Class456>(Class455.Class456.smethod_1));
                    Class455.Class456 class456_1 = class456List[index1];
                    class456List.RemoveAt(index1);
                    while (class456List.Count > 0)
                    {
                        Class455.Class456 class456_2 = class456List[0];
                        class456List.RemoveAt(0);
                        double parameter = 0.5 * (class456_1.double_1 + class456_2.double_1);
                        if (class456_2.double_1 < class456_1.double_1)
                        {
                            parameter += 0.5 * (double)count;
                        }
                        if (Class455.Contains(this.class461_0, (Point2D)Class455.smethod_1(polylineInfo.polyline3D_0, parameter)))
                        {
                            Polyline4D result = new Polyline4D();
                            this.method_0(result, class456_1.double_1, class456_2.double_1, polylineInfo);
                            polyline4DList.Add(result);
                        }
                        class456_1 = class456_2;
                    }
                    if (!polyline.Closed && flag2)
                    {
                        Polyline4D result = new Polyline4D();
                        this.method_0(result, class456_1.double_1, (double)(polyline.Count - 1), polylineInfo);
                        polyline4DList.Add(result);
                    }
                }
                return((IList <Polyline4D>)polyline4DList);
            }
        }
Example #9
0
        private void method_0(
            IShape2D path,
            Color color,
            Matrix4D transform,
            bool filled,
            double extrusion,
            bool isChar)
        {
            if (!path.HasSegments)
            {
                return;
            }
            ISurfaceGraphicsFactory graphicsFactory0 = this.isurfaceGraphicsFactory_0;
            IList <Polyline2D>      flattened        = (IList <Polyline2D>)ShapeTool.GetFlattened(path, this.surface_0.Config.ShapeFlattenEpsilon);

            this.isurfaceGraphicsFactory_0.SetColor(this.surface_0.GetPlotColor(this.dxfEntity_0, color));
            Interface41 transformer = (Interface41)this.surface_0.GetTransformer().Clone();

            transformer.SetPreTransform(transform);
            if (!filled)
            {
                IList <Polyline4D> polyline4DList1 = DxfUtil.smethod_48(flattened, transformer);
                foreach (Polyline4D polyline4D in (IEnumerable <Polyline4D>)polyline4DList1)
                {
                    graphicsFactory0.CreatePolyline((IList <Vector4D>)polyline4D, polyline4D.Closed);
                }
                if (extrusion == 0.0)
                {
                    return;
                }
                transformer.SetPreTransform(Transformation4D.Translation(0.0, 0.0, extrusion));
                IList <Polyline4D> polyline4DList2 = DxfUtil.smethod_48(flattened, transformer);
                foreach (Polyline4D polyline4D in (IEnumerable <Polyline4D>)polyline4DList2)
                {
                    graphicsFactory0.CreatePolyline((IList <Vector4D>)polyline4D, polyline4D.Closed);
                }
                Polyline4D polyline4D1 = new Polyline4D(2);
                polyline4D1.Add(Vector4D.Zero);
                polyline4D1.Add(Vector4D.Zero);
                for (int index1 = polyline4DList1.Count - 1; index1 >= 0; --index1)
                {
                    Polyline4D polyline4D2 = polyline4DList1[index1];
                    Polyline4D polyline4D3 = polyline4DList2[index1];
                    for (int index2 = polyline4D2.Count - 1; index2 >= 0; --index2)
                    {
                        polyline4D1[0] = polyline4D2[index2];
                        polyline4D1[1] = polyline4D3[index2];
                        graphicsFactory0.CreatePolyline((IList <Vector4D>)polyline4D1, false);
                    }
                }
            }
            else
            {
                List <Triangulator2D.Triangle> triangleList;
                List <WW.Math.Point2D>         point2DList;
                if (isChar)
                {
                    Class454 class454 = this.surface_0.CharTriangulationCache.method_0(path, this.surface_0.Config);
                    triangleList = class454.Triangles;
                    point2DList  = class454.Points;
                }
                else
                {
                    triangleList = new List <Triangulator2D.Triangle>();
                    point2DList  = new List <WW.Math.Point2D>();
                    IList <IList <WW.Math.Point2D> > polygons = (IList <IList <WW.Math.Point2D> >) new List <IList <WW.Math.Point2D> >();
                    foreach (Polyline2D polyline2D in (IEnumerable <Polyline2D>)flattened)
                    {
                        polygons.Add((IList <WW.Math.Point2D>)polyline2D);
                    }
                    Triangulator2D.Triangulate(polygons, (IList <Triangulator2D.Triangle>)triangleList, (IList <WW.Math.Point2D>)point2DList);
                }
                Polyline2D polyline    = new Polyline2D((IEnumerable <WW.Math.Point2D>)point2DList);
                Polyline4D polyline4D1 = DxfUtil.smethod_49(polyline, transformer);
                if (extrusion == 0.0)
                {
                    for (int index = 0; index < triangleList.Count; ++index)
                    {
                        Triangulator2D.Triangle triangle = triangleList[index];
                        this.isurfaceGraphicsFactory_0.CreateTriangle(polyline4D1[triangle.I0], polyline4D1[triangle.I1], polyline4D1[triangle.I2], (IList <bool>)null);
                    }
                }
                else
                {
                    if (extrusion == 0.0)
                    {
                        return;
                    }
                    IList <Polyline4D> polyline4DList1 = DxfUtil.smethod_48(flattened, transformer);
                    transformer.SetPreTransform(Transformation4D.Translation(0.0, 0.0, extrusion));
                    Polyline4D         polyline4D2     = DxfUtil.smethod_49(polyline, transformer);
                    IList <Polyline4D> polyline4DList2 = DxfUtil.smethod_48(flattened, transformer);
                    if (extrusion > 0.0)
                    {
                        for (int index = 0; index < triangleList.Count; ++index)
                        {
                            Triangulator2D.Triangle triangle = triangleList[index];
                            this.isurfaceGraphicsFactory_0.CreateTriangle(polyline4D1[triangle.I0], polyline4D1[triangle.I2], polyline4D1[triangle.I1], (IList <bool>)null);
                        }
                        for (int index = 0; index < triangleList.Count; ++index)
                        {
                            Triangulator2D.Triangle triangle = triangleList[index];
                            this.isurfaceGraphicsFactory_0.CreateTriangle(polyline4D2[triangle.I0], polyline4D2[triangle.I1], polyline4D2[triangle.I2], (IList <bool>)null);
                        }
                    }
                    else
                    {
                        for (int index = 0; index < triangleList.Count; ++index)
                        {
                            Triangulator2D.Triangle triangle = triangleList[index];
                            this.isurfaceGraphicsFactory_0.CreateTriangle(polyline4D1[triangle.I0], polyline4D1[triangle.I1], polyline4D1[triangle.I2], (IList <bool>)null);
                        }
                        for (int index = 0; index < triangleList.Count; ++index)
                        {
                            Triangulator2D.Triangle triangle = triangleList[index];
                            this.isurfaceGraphicsFactory_0.CreateTriangle(polyline4D2[triangle.I0], polyline4D2[triangle.I2], polyline4D2[triangle.I1], (IList <bool>)null);
                        }
                    }
                    for (int index1 = polyline4DList1.Count - 1; index1 >= 0; --index1)
                    {
                        Polyline4D       polyline4D3 = polyline4DList1[index1];
                        Polyline4D       polyline4D4 = polyline4DList2[index1];
                        Polyline2D       polyline2D  = flattened[index1];
                        IList <Vector3D> normals     = (IList <Vector3D>) new List <Vector3D>(polyline4D3.Count + 1);
                        for (int index2 = 0; index2 < polyline4D3.Count; ++index2)
                        {
                            int      index3   = (index2 + 1) % polyline4D3.Count;
                            Vector2D vector2D = polyline2D[index3] - polyline2D[index2];
                            normals.Add(transformer.Transform(new Vector3D(vector2D.Y, -vector2D.X, 0.0)));
                        }
                        normals.Add(normals[0]);
                        this.isurfaceGraphicsFactory_0.CreateQuadStrip((IList <Vector4D>)polyline4D3, (IList <Vector4D>)polyline4D4, normals, 0, 0);
                    }
                }
            }
        }