Beispiel #1
0
        internal List <DelaunayTriangulation2d.Class15> method_9(Point point_0)
        {
            List <DelaunayTriangulation2d.Class15> list = new List <DelaunayTriangulation2d.Class15>();

            DelaunayTriangulation2d.Class15 @class = this.method_6(this.class15_0, point_0);
            DelaunayTriangulation2d.Class15 class2 = @class;
            bool flag = true;

            while (flag)
            {
                switch (class2.method_12().method_19(point_0))
                {
                case 1:
                    class2 = class2.method_10();
                    break;

                case 2:
                    class2 = class2.method_6();
                    break;

                case 3:
                    class2 = class2.method_8();
                    break;

                default:
                    throw new ArithmeticException("Can not find incident triangles at following vertex:\n" + point_0.ToString() + "\nThe vertex is not part of the current triangulation.");
                }
                list.Add(class2);
                if (@class == class2)
                {
                    flag = false;
                }
            }
            return(list);
        }
Beispiel #2
0
        public double GetZCoordinate(Point point)
        {
            DelaunayTriangulation2d.Class15 @class = this.method_6(this.class15_0, point);
            if (@class == null)
            {
                return(double.NaN);
            }
            if (@class.method_2())
            {
                return(double.NaN);
            }
            Point    point2    = @class.method_12().getPoint0();
            Point    left      = @class.method_12().getPoint1();
            Point    left2     = @class.method_12().getPoint2();
            Vector3d vector3d  = new Vector3d(left - point2);
            Vector3d vector3d2 = new Vector3d(left2 - point2);
            Vector3d vector3d3 = new Vector3d(point - point2);
            double   num       = vector3d3.X * (vector3d.Y * vector3d2.Z - vector3d.Z * vector3d2.Y);
            double   num2      = vector3d3.Y * (vector3d.Z * vector3d2.X - vector3d.X * vector3d2.Z);
            double   num3      = vector3d.X * vector3d2.Y - vector3d.Y * vector3d2.X;

            if (Math.Abs(num3) < 4.94065645841247E-324)
            {
                return(double.NaN);
            }
            return((-num - num2) / num3 + point2.Z);
        }
Beispiel #3
0
 internal DelaunayTriangulation2d.Class15 method_6(DelaunayTriangulation2d.Class15 class15_1, Point point_0)
 {
     DelaunayTriangulation2d.Class15 @class = class15_1;
     while ([email protected]_0() & [email protected]_2())
     {
         List <DelaunayTriangulation2d.Class15> list = @class.method_4();
         int  count = list.Count;
         bool flag  = true;
         int  num   = 0;
         while (flag)
         {
             if (num >= count)
             {
                 @class = new DelaunayTriangulation2d.Class15();
                 @class.method_3(true);
                 @class.method_1(false);
                 flag = false;
             }
             else
             {
                 DelaunayTriangulation2d.Class15 class2 = list[num];
                 if (Predicate.InTriangle2dExact(class2.method_12().getPoint0(), class2.method_12().getPoint1(), class2.method_12().getPoint2(), point_0) >= 0.0)
                 {
                     @class = this.method_6(class2, point_0);
                     flag   = false;
                 }
                 num++;
             }
         }
     }
     return(@class);
 }
Beispiel #4
0
 internal void method_7(DelaunayTriangulation2d.Class15 class15_1, DelaunayTriangulation2d.Class15 class15_2)
 {
     class15_2.method_1(false);
     class15_2.method_4().Add(class15_1);
     class15_2.method_7(null);
     class15_2.method_9(null);
     class15_2.method_11(null);
 }
Beispiel #5
0
 private void method_4(DelaunayTriangulation2d.Class15 class15_1, DelaunayTriangulation2d.Class15 class15_2)
 {
     if (class15_2 == null)
     {
         return;
     }
     if (!class15_1.method_12().method_18(class15_2.method_12().getPoint0()))
     {
         class15_2.method_7(class15_1);
         return;
     }
     if (!class15_1.method_12().method_18(class15_2.method_12().getPoint1()))
     {
         class15_2.method_9(class15_1);
         return;
     }
     class15_2.method_11(class15_1);
 }
Beispiel #6
0
        private void method_2(Point point_0, DelaunayTriangulation2d.Class15 class15_1, DelaunayTriangulation2d.Class15 class15_2)
        {
            if (class15_2 == null)
            {
                return;
            }
            Point point = this.method_3(class15_1.method_12(), class15_2.method_12());

            if (Predicate.InCircleOrdered(class15_1.method_12().getPoint0(), class15_1.method_12().getPoint1(), class15_1.method_12().getPoint2(), point) > 0.0)
            {
                DelaunayTriangulation2d.Class15 @class = new DelaunayTriangulation2d.Class15(new Class24(class15_1.method_12().getPoint0(), point, point_0));
                DelaunayTriangulation2d.Class15 class2 = new DelaunayTriangulation2d.Class15(new Class24(point, class15_1.method_12().getPoint1(), point_0));
                @class.method_7(class2);
                @class.method_9(class15_1.method_8());
                class2.method_7(class15_1.method_6());
                class2.method_9(@class);
                if (class15_1.method_12().getPoint0().X == class15_2.method_12().getPoint0().X & class15_1.method_12().getPoint0().Y == class15_2.method_12().getPoint0().Y)
                {
                    @class.method_11(class15_2.method_10());
                    class2.method_11(class15_2.method_6());
                }
                else if (class15_1.method_12().getPoint0().X == class15_2.method_12().getPoint1().X & class15_1.method_12().getPoint0().Y == class15_2.method_12().getPoint1().Y)
                {
                    @class.method_11(class15_2.method_6());
                    class2.method_11(class15_2.method_8());
                }
                else
                {
                    @class.method_11(class15_2.method_8());
                    class2.method_11(class15_2.method_10());
                }
                this.method_4(@class, @class.method_8());
                this.method_4(@class, @class.method_10());
                this.method_4(class2, class2.method_6());
                this.method_4(class2, class2.method_10());
                this.method_8(@class, class15_1, class15_2);
                this.method_8(class2, class15_1, class15_2);
                this.list_0.Add(@class);
                this.list_0.Add(class2);
                this.method_2(point_0, @class, @class.method_10());
                this.method_2(point_0, class2, class2.method_10());
            }
        }
Beispiel #7
0
        internal bool method_10(Point point_0)
        {
            bool result;

            try
            {
                DelaunayTriangulation2d.Class15 @class = this.method_6(this.class15_0, point_0);
                if (@class.method_12().method_17(this.class24_0))
                {
                    result = false;
                }
                else
                {
                    result = true;
                }
            }
            catch (System.Exception ex)
            {
                result = false;
            }
            return(result);
        }
Beispiel #8
0
 internal void method_9(DelaunayTriangulation2d.Class15 class15_3)
 {
     this.class15_1 = class15_3;
 }
Beispiel #9
0
 public void Triangulate()
 {
     if (this.pointSet_0 == null)
     {
         throw new InvalidOperationException("No point set to triangulate.");
     }
     if (this.pointSet_0.Count < 3)
     {
         throw new IndexOutOfRangeException("Can not triangulate less than three vertices");
     }
     this.class15_0 = null;
     this.list_0    = new List <DelaunayTriangulation2d.Class15>();
     this.list_1    = new List <Point>();
     this.pointSet_0.RandomPermute();
     if (!Class20.bool_0)
     {
         Class20.smethod_0();
     }
     this.class24_0 = this.getBoundaryPoint(this.pointSet_0);
     this.class15_0 = new DelaunayTriangulation2d.Class15(this.class24_0);
     for (int i = 0; i < this.pointSet_0.Count; i++)
     {
         this.vmethod_0(this.pointSet_0[i], new DelaunayTriangulation2d.PointInsertionEventArg(i, this.pointSet_0.Count, true));
         Point point = this.pointSet_0[i];
         DelaunayTriangulation2d.Class15 @class = this.method_6(this.class15_0, point);
         if (@class.method_2())
         {
             this.list_1.Add(point);
         }
         else if (Predicate.InTriangle2dExact(@class.method_12().getPoint0(), @class.method_12().getPoint1(), @class.method_12().getPoint2(), point) == 0.0)
         {
             DelaunayTriangulation2d.Class15 class2;
             if (Predicate.Orient2d_exact(@class.method_12().getPoint0(), @class.method_12().getPoint1(), point) == 0.0)
             {
                 class2 = @class.method_10();
             }
             else if (Predicate.Orient2d_exact(@class.method_12().getPoint1(), @class.method_12().getPoint2(), point) == 0.0)
             {
                 class2 = @class.method_6();
             }
             else
             {
                 class2 = @class.method_8();
             }
             this.method_5(@class, class2);
             DelaunayTriangulation2d.Class15 class3 = new DelaunayTriangulation2d.Class15(new Class24(@class.method_12().getPoint2(), @class.method_12().getPoint0(), point));
             DelaunayTriangulation2d.Class15 class4 = new DelaunayTriangulation2d.Class15(new Class24(@class.method_12().getPoint1(), @class.method_12().getPoint2(), point));
             DelaunayTriangulation2d.Class15 class5 = new DelaunayTriangulation2d.Class15(new Class24(@class.method_10().method_12().getPoint2(), @class.method_10().method_12().getPoint0(), point));
             DelaunayTriangulation2d.Class15 class6 = new DelaunayTriangulation2d.Class15(new Class24(@class.method_10().method_12().getPoint1(), @class.method_10().method_12().getPoint2(), point));
             class3.method_7(class6);
             class3.method_9(class4);
             class3.method_11(@class.method_8());
             class4.method_7(class3);
             class4.method_9(class5);
             class4.method_11(@class.method_6());
             class5.method_7(class4);
             class5.method_9(class6);
             class5.method_11(class2.method_8());
             class6.method_7(class5);
             class6.method_9(class3);
             class6.method_11(class2.method_6());
             this.method_4(class3, @class.method_8());
             this.method_4(class4, @class.method_6());
             this.method_4(class5, class2.method_8());
             this.method_4(class6, class2.method_6());
             this.method_7(class3, @class);
             this.method_7(class4, @class);
             this.method_7(class5, class2);
             this.method_7(class6, class2);
             this.list_0.Add(class3);
             this.list_0.Add(class4);
             this.list_0.Add(class5);
             this.list_0.Add(class6);
             this.method_2(point, class3, class3.method_10());
             this.method_2(point, class4, class4.method_10());
             this.method_2(point, class5, class5.method_10());
             this.method_2(point, class6, class6.method_10());
         }
         else
         {
             DelaunayTriangulation2d.Class15 class7 = new DelaunayTriangulation2d.Class15(new Class24(@class.method_12().getPoint0(), @class.method_12().getPoint1(), point));
             DelaunayTriangulation2d.Class15 class8 = new DelaunayTriangulation2d.Class15(new Class24(@class.method_12().getPoint1(), @class.method_12().getPoint2(), point));
             DelaunayTriangulation2d.Class15 class9 = new DelaunayTriangulation2d.Class15(new Class24(@class.method_12().getPoint2(), @class.method_12().getPoint0(), point));
             class7.method_7(class8);
             class7.method_9(class9);
             class7.method_11(@class.method_10());
             class8.method_7(class9);
             class8.method_9(class7);
             class8.method_11(@class.method_6());
             class9.method_7(class7);
             class9.method_9(class8);
             class9.method_11(@class.method_8());
             this.method_4(class7, @class.method_10());
             this.method_4(class8, @class.method_6());
             this.method_4(class9, @class.method_8());
             this.method_7(class7, @class);
             this.method_7(class8, @class);
             this.method_7(class9, @class);
             this.list_0.Add(class7);
             this.list_0.Add(class8);
             this.list_0.Add(class9);
             this.method_2(point, class7, class7.method_10());
             this.method_2(point, class8, class8.method_10());
             this.method_2(point, class9, class9.method_10());
         }
     }
 }
Beispiel #10
0
 internal void method_8(DelaunayTriangulation2d.Class15 class15_1, DelaunayTriangulation2d.Class15 class15_2, DelaunayTriangulation2d.Class15 class15_3)
 {
     this.method_7(class15_1, class15_2);
     this.method_7(class15_1, class15_3);
 }
Beispiel #11
0
 private void method_5(DelaunayTriangulation2d.Class15 class15_1, DelaunayTriangulation2d.Class15 class15_2)
 {
     if (!class15_2.method_12().method_18(class15_1.method_12().getPoint0()))
     {
         DelaunayTriangulation2d.Class15 @class = new DelaunayTriangulation2d.Class15();
         @class.method_7(class15_1.method_6());
         @class.method_9(class15_1.method_8());
         @class.method_11(class15_1.method_10());
         Class24 class2 = new Class24();
         class2.setPoint2(class15_1.method_12().getPoint0());
         class2.setPoint0(class15_1.method_12().getPoint1());
         class2.setPoint1(class15_1.method_12().getPoint2());
         class15_1.method_13(class2);
         class15_1.method_11(@class.method_6());
         class15_1.method_7(@class.method_8());
         class15_1.method_9(@class.method_10());
     }
     else if (!class15_2.method_12().method_18(class15_1.method_12().getPoint1()))
     {
         DelaunayTriangulation2d.Class15 class3 = new DelaunayTriangulation2d.Class15();
         class3.method_7(class15_1.method_6());
         class3.method_9(class15_1.method_8());
         class3.method_11(class15_1.method_10());
         Class24 class4 = new Class24();
         class4.setPoint1(class15_1.method_12().getPoint0());
         class4.setPoint2(class15_1.method_12().getPoint1());
         class4.setPoint0(class15_1.method_12().getPoint2());
         class15_1.method_13(class4);
         class15_1.method_9(class3.method_6());
         class15_1.method_11(class3.method_8());
         class15_1.method_7(class3.method_10());
     }
     if (!class15_1.method_12().method_18(class15_2.method_12().getPoint0()))
     {
         DelaunayTriangulation2d.Class15 class5 = new DelaunayTriangulation2d.Class15();
         class5.method_7(class15_2.method_6());
         class5.method_9(class15_2.method_8());
         class5.method_11(class15_2.method_10());
         Class24 class6 = new Class24();
         class6.setPoint2(class15_2.method_12().getPoint0());
         class6.setPoint0(class15_2.method_12().getPoint1());
         class6.setPoint1(class15_2.method_12().getPoint2());
         class15_2.method_13(class6);
         class15_2.method_11(class5.method_6());
         class15_2.method_7(class5.method_8());
         class15_2.method_9(class5.method_10());
         return;
     }
     if (!class15_1.method_12().method_18(class15_2.method_12().getPoint1()))
     {
         DelaunayTriangulation2d.Class15 class7 = new DelaunayTriangulation2d.Class15();
         class7.method_7(class15_2.method_6());
         class7.method_9(class15_2.method_8());
         class7.method_11(class15_2.method_10());
         Class24 class8 = new Class24();
         class8.setPoint1(class15_2.method_12().getPoint0());
         class8.setPoint2(class15_2.method_12().getPoint1());
         class8.setPoint0(class15_2.method_12().getPoint2());
         class15_2.method_13(class8);
         class15_2.method_9(class7.method_6());
         class15_2.method_11(class7.method_8());
         class15_2.method_7(class7.method_10());
     }
 }
Beispiel #12
0
 public bool AddPointToCurrentTriangulation(Point vertexToInsert)
 {
     if (this.class15_0 == null | this.list_0 == null)
     {
         throw new InvalidOperationException("A valid triangulation does not exist. Compute the triangulation first!");
     }
     this.pointSet_0.Add(vertexToInsert);
     this.vmethod_0(vertexToInsert, new DelaunayTriangulation2d.PointInsertionEventArg(this.pointSet_0.Count, this.pointSet_0.Count, false));
     DelaunayTriangulation2d.Class15 @class = this.method_6(this.class15_0, vertexToInsert);
     if (@class.method_2())
     {
         this.list_1.Add(vertexToInsert);
         return(false);
     }
     if (@class.method_12().method_18(vertexToInsert))
     {
         this.list_1.Add(vertexToInsert);
         return(false);
     }
     if (Predicate.InTriangle2dExact(@class.method_12().getPoint0(), @class.method_12().getPoint1(), @class.method_12().getPoint2(), vertexToInsert) == 0.0)
     {
         DelaunayTriangulation2d.Class15 class2;
         if (Predicate.Orient2d_exact(@class.method_12().getPoint0(), @class.method_12().getPoint1(), vertexToInsert) == 0.0)
         {
             class2 = @class.method_10();
         }
         else if (Predicate.Orient2d_exact(@class.method_12().getPoint1(), @class.method_12().getPoint2(), vertexToInsert) == 0.0)
         {
             class2 = @class.method_6();
         }
         else
         {
             class2 = @class.method_8();
         }
         this.method_5(@class, class2);
         DelaunayTriangulation2d.Class15 class3 = new DelaunayTriangulation2d.Class15(new Class24(@class.method_12().getPoint2(), @class.method_12().getPoint0(), vertexToInsert));
         DelaunayTriangulation2d.Class15 class4 = new DelaunayTriangulation2d.Class15(new Class24(@class.method_12().getPoint1(), @class.method_12().getPoint2(), vertexToInsert));
         DelaunayTriangulation2d.Class15 class5 = new DelaunayTriangulation2d.Class15(new Class24(@class.method_10().method_12().getPoint2(), @class.method_10().method_12().getPoint0(), vertexToInsert));
         DelaunayTriangulation2d.Class15 class6 = new DelaunayTriangulation2d.Class15(new Class24(@class.method_10().method_12().getPoint1(), @class.method_10().method_12().getPoint2(), vertexToInsert));
         class3.method_7(class6);
         class3.method_9(class4);
         class3.method_11(@class.method_8());
         class4.method_7(class3);
         class4.method_9(class5);
         class4.method_11(@class.method_6());
         class5.method_7(class4);
         class5.method_9(class6);
         class5.method_11(class2.method_8());
         class6.method_7(class5);
         class6.method_9(class3);
         class6.method_11(class2.method_6());
         this.method_4(class3, @class.method_8());
         this.method_4(class4, @class.method_6());
         this.method_4(class5, class2.method_8());
         this.method_4(class6, class2.method_6());
         this.method_7(class3, @class);
         this.method_7(class4, @class);
         this.method_7(class5, class2);
         this.method_7(class6, class2);
         this.list_0.Add(class3);
         this.list_0.Add(class4);
         this.list_0.Add(class5);
         this.list_0.Add(class6);
         this.method_2(vertexToInsert, class3, class3.method_10());
         this.method_2(vertexToInsert, class4, class4.method_10());
         this.method_2(vertexToInsert, class5, class5.method_10());
         this.method_2(vertexToInsert, class6, class6.method_10());
     }
     else
     {
         DelaunayTriangulation2d.Class15 class7 = new DelaunayTriangulation2d.Class15(new Class24(@class.method_12().getPoint0(), @class.method_12().getPoint1(), vertexToInsert));
         DelaunayTriangulation2d.Class15 class8 = new DelaunayTriangulation2d.Class15(new Class24(@class.method_12().getPoint1(), @class.method_12().getPoint2(), vertexToInsert));
         DelaunayTriangulation2d.Class15 class9 = new DelaunayTriangulation2d.Class15(new Class24(@class.method_12().getPoint2(), @class.method_12().getPoint0(), vertexToInsert));
         class7.method_7(class8);
         class7.method_9(class9);
         class7.method_11(@class.method_10());
         class8.method_7(class9);
         class8.method_9(class7);
         class8.method_11(@class.method_6());
         class9.method_7(class7);
         class9.method_9(class8);
         class9.method_11(@class.method_8());
         this.method_4(class7, @class.method_10());
         this.method_4(class8, @class.method_6());
         this.method_4(class9, @class.method_8());
         this.method_7(class7, @class);
         this.method_7(class8, @class);
         this.method_7(class9, @class);
         this.list_0.Add(class7);
         this.list_0.Add(class8);
         this.list_0.Add(class9);
         this.method_2(vertexToInsert, class7, class7.method_10());
         this.method_2(vertexToInsert, class8, class8.method_10());
         this.method_2(vertexToInsert, class9, class9.method_10());
     }
     return(true);
 }