Exemple #1
0
        public new void Triangulate()
        {
            this.int_1          = 0;
            this.int_2          = 0;
            this.badConstraints = new List <Constraint>();
            List <Class16> list = new List <Class16>();

            for (int i = 0; i < base.TriangulationPoints.Count; i++)
            {
                list.Add(new Class16(base.TriangulationPoints[i], (aabbcc)1));
            }
            for (int j = 0; j < this.constraints.Count; j++)
            {
                list.Add(new Class16(this.constraints[j].Edge.StartPoint, (aabbcc)2));
                list.Add(new Class16(this.constraints[j].Edge.EndPoint, (aabbcc)2));
            }
            if (list.Count < 3)
            {
                throw new ArgumentException("Can not triangulate less than three vertices.");
            }
            List <Point> collection = new List <Point>();

            base.TriangulationPoints = Class16.getCleanedPoints(list, ref collection);
            base.Triangulate();
            base.BadPoints.AddRange(collection);
            if (this.constraints.Count == 0 && this.boundaries.Count == 0)
            {
                return;
            }
            List <Constraint> list2 = new List <Constraint>();

            list2.AddRange(this.constraints);
            this.method_13(ref list2);
            this.int_0 = 0;
            if (this.boundaries.Count > 0)
            {
                this.method_12();
                list2.Clear();
                list2.AddRange(this.boundaries);
                this.method_13(ref list2);
            }
        }
Exemple #2
0
        private void method_12()
        {
            List <Class16> list = new List <Class16>();

            for (int i = 0; i < this.boundaries.Count; i++)
            {
                list.Add(new Class16(this.boundaries[i].Edge.StartPoint, (aabbcc)0));
                list.Add(new Class16(this.boundaries[i].Edge.EndPoint, (aabbcc)0));
            }
            List <Point> collection = new List <Point>();
            PointSet     pointSet   = Class16.getCleanedPoints(list, ref collection);

            base.BadPoints.AddRange(collection);
            for (int j = 0; j < pointSet.Count; j++)
            {
                if (!base.method_10(pointSet[j]))
                {
                    pointSet[j].Z = base.GetZCoordinate(pointSet[j]);
                    if (double.IsNaN(pointSet[j].Z))
                    {
                        throw new ArgumentException("Boundary point " + pointSet[j].ToString() + " does not lie within the triangulated surface.");
                    }
                }
                else
                {
                    pointSet[j].Z = base.GetZCoordinate(pointSet[j]);
                }
            }
            for (int k = 0; k < pointSet.Count; k++)
            {
                if (base.AddPointToCurrentTriangulation(pointSet[k]))
                {
                    this.int_2++;
                }
            }
        }