public IShape4D Transform(IShape4D shape)
        {
            switch (shape.CheckClipping((IInsideTester4D)this.interface32_0))
            {
            case InsideTestResult.None:
            case InsideTestResult.Outside:
                return(NullShape4D.Instance);

            case InsideTestResult.Inside:
                shape.Transform(this.matrix4D_0);
                return(shape);

            default:
                IList <Polyline4D> polylines4D    = shape.ToPolylines4D(this.double_0);
                List <Polyline4D>  polyline4DList = new List <Polyline4D>(polylines4D.Count);
                int count = polylines4D.Count;
                for (int index = 0; index < count; ++index)
                {
                    polyline4DList.AddRange((IEnumerable <Polyline4D>) this.interface32_0.Clip(polylines4D[index], shape.IsFilled));
                }
                IShape4D shape4D = (IShape4D) new PolylineShape4D((IList <Polyline4D>)polyline4DList, shape.IsFilled);
                shape4D.Transform(this.matrix4D_0);
                return(shape4D);
            }
        }
示例#2
0
文件: ClipUtil.cs 项目: 15831944/WW
        public static InsideTestResult IsInside(
            IClipper4D clipper,
            IShape4D shape,
            double shapeFlattenEpsilonForBoundsCalculation)
        {
            InsideTestResult insideTestResult = InsideTestResult.None;

            foreach (Polyline4D polyline in (IEnumerable <Polyline4D>)shape.ToPolylines4D(shapeFlattenEpsilonForBoundsCalculation))
            {
                IList <Polyline4D> polyline4DList = clipper.Clip(polyline, shape.IsFilled);
                switch (polyline4DList.Count)
                {
                case 0:
                    insideTestResult |= InsideTestResult.Outside;
                    break;

                case 1:
                    if (polyline == polyline4DList[0])
                    {
                        insideTestResult |= InsideTestResult.Inside;
                        break;
                    }
                    insideTestResult = InsideTestResult.BothSides;
                    break;

                default:
                    insideTestResult = InsideTestResult.BothSides;
                    break;
                }
                if (insideTestResult == InsideTestResult.BothSides)
                {
                    break;
                }
            }
            return(insideTestResult);
        }
示例#3
0
        public IShape4D Transform(IShape4D shape)
        {
            shape.Transform(this.matrix4D_0);
            switch (shape.CheckClipping((IInsideTester4D)this.blinnClipper4D_0))
            {
            case InsideTestResult.None:
            case InsideTestResult.Outside:
                return(NullShape4D.Instance);

            case InsideTestResult.Inside:
                shape.Transform(this.matrix4D_1);
                return(shape);

            default:
                IList <Polyline4D> polylines4D     = shape.ToPolylines4D(this.double_0);
                List <Polyline4D>  polyline4DList1 = new List <Polyline4D>(polylines4D.Count);
                int  count = polylines4D.Count;
                bool flag  = true;
                for (int index = 0; index < count; ++index)
                {
                    Polyline4D         polyline        = polylines4D[index];
                    IList <Polyline4D> polyline4DList2 = this.blinnClipper4D_0.Clip(polyline, shape.IsFilled);
                    if (polyline4DList2.Count != 1 || polyline4DList2[0] != polyline)
                    {
                        flag = false;
                    }
                    polyline4DList1.AddRange((IEnumerable <Polyline4D>)DxfUtil.GetTransformed((IEnumerable <Polyline4D>)polyline4DList2, this.matrix4D_1));
                }
                if (!flag)
                {
                    return((IShape4D) new PolylineShape4D((IList <Polyline4D>)polyline4DList1, shape.IsFilled));
                }
                shape.Transform(this.matrix4D_1);
                return(shape);
            }
        }