예제 #1
0
파일: Class455.cs 프로젝트: 15831944/WW
 public static int smethod_2(Class455.Class456 i1, Class455.Class456 i2)
 {
     if (System.Math.Abs(i1.double_0 - i2.double_0) >= 1E-08)
     {
         return(Class455.Class456.smethod_0(i1, i2));
     }
     return(Class455.Class456.smethod_1(i1, i2));
 }
예제 #2
0
파일: Class455.cs 프로젝트: 15831944/WW
        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)));
        }
예제 #3
0
파일: Class455.cs 프로젝트: 15831944/WW
 public static int smethod_1(Class455.Class456 i1, Class455.Class456 i2)
 {
     return(i1.double_1.CompareTo(i2.double_1));
 }
예제 #4
0
파일: Class455.cs 프로젝트: 15831944/WW
        private static void smethod_5(
            Class455.Class458 edge1,
            Class455.Class458 edge2,
            List <Class455.Class456> intersections)
        {
            Class455.Class458 class458_1;
            Class455.Class458 class458_2;
            if (edge1.bool_0)
            {
                class458_1 = edge2;
                class458_2 = edge1;
            }
            else
            {
                class458_1 = edge1;
                class458_2 = edge2;
            }
            Vector3D vector3D0_1 = class458_1.vector3D_0;
            Vector3D vector3D0_2 = class458_2.vector3D_0;
            double   num1        = 1E-08 * class458_1.double_0 * class458_2.double_0;
            double   num2        = vector3D0_1.X * vector3D0_2.Y - vector3D0_1.Y * vector3D0_2.X;

            if (System.Math.Abs(num2) < num1)
            {
                Vector3D vector3D = class458_1.point3D_0 - class458_2.point3D_0;
                if (System.Math.Abs(vector3D.X * vector3D0_2.Y - vector3D.Y * vector3D0_2.X) >= num1)
                {
                    return;
                }
                double val1 = class458_2.method_0(class458_1.point3D_0.X, class458_1.point3D_0.Y);
                double val2 = class458_2.method_0(class458_1.point3D_1.X, class458_1.point3D_1.Y);
                double num3 = System.Math.Min(val1, val2);
                if (num3 > 1.0)
                {
                    return;
                }
                double num4 = System.Math.Max(val1, val2);
                if (num4 < 0.0)
                {
                    return;
                }
                if (num3 < 0.0)
                {
                    num3 = 0.0;
                }
                if (num4 > 1.0)
                {
                    num4 = 1.0;
                }
                if (num4 - num3 < 1E-08)
                {
                    double  num5      = 0.5 * (num3 + num4);
                    Point2D point2D   = class458_2.method_1(num5);
                    double  clipParam = class458_1.method_0(point2D.X, point2D.Y);
                    if (clipParam < 0.0 || clipParam > 1.0)
                    {
                        return;
                    }
                    Class455.Class456 class456 = new Class455.Class456(class458_1.int_0, clipParam, class458_2.int_0, num5);
                    intersections?.Add(class456);
                }
                else
                {
                    if (intersections == null)
                    {
                        return;
                    }
                    Point2D point2D    = class458_2.method_1(num3);
                    double  clipParam1 = class458_1.method_0(point2D.X, point2D.Y);
                    if (clipParam1 < 0.0 || clipParam1 > 1.0)
                    {
                        return;
                    }
                    intersections.Add(new Class455.Class456(class458_1.int_0, clipParam1, class458_2.int_0, num3));
                    point2D = class458_2.method_1(num4);
                    double clipParam2 = class458_1.method_0(point2D.X, point2D.Y);
                    intersections.Add(new Class455.Class456(class458_1.int_0, clipParam2, class458_2.int_0, num4));
                }
            }
            else
            {
                Vector3D vector3D  = class458_2.point3D_0 - class458_1.point3D_0;
                double   clipParam = (vector3D.X * vector3D0_2.Y - vector3D.Y * vector3D0_2.X) / num2;
                if (clipParam < 0.0 || clipParam > 1.0)
                {
                    return;
                }
                double polygonParam = (vector3D.X * vector3D0_1.Y - vector3D.Y * vector3D0_1.X) / num2;
                if (polygonParam < 0.0 || polygonParam > 1.0)
                {
                    return;
                }
                Class455.Class456 class456 = new Class455.Class456(class458_1.int_0, clipParam, class458_2.int_0, polygonParam);
                intersections?.Add(class456);
            }
        }
예제 #5
0
파일: Class455.cs 프로젝트: 15831944/WW
        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);
            }
        }