Пример #1
0
 public Chord2D(Vertex2D src, Vertex2D dst, Face2D face)
 {
     this.src        = src;
     this.dst        = dst;
     this.face       = face;
     this.connection = new List <Chord2D>();
 }
Пример #2
0
 void CheckAndAdd(Segment2D s, Face2D f)
 {
     if (!connections.ContainsKey(s))
     {
         connections.Add(s, new List <Face2D>());
     }
     connections[s].Add(f);
 }
Пример #3
0
        public List <Neighbor2D> GetNeighbors(Face2D f)
        {
            var neighbors0 = connections[f.Triangle.s0].FindAll(f2 => f2 != f).Select(f2 => new Neighbor2D(f2, f.Triangle.s0));
            var neighbors1 = connections[f.Triangle.s1].FindAll(f2 => f2 != f).Select(f2 => new Neighbor2D(f2, f.Triangle.s1));
            var neighbors2 = connections[f.Triangle.s2].FindAll(f2 => f2 != f).Select(f2 => new Neighbor2D(f2, f.Triangle.s2));

            var neighbors = new List <Neighbor2D>();

            neighbors.AddRange(neighbors0);
            neighbors.AddRange(neighbors1);
            neighbors.AddRange(neighbors2);
            return(neighbors);
        }
Пример #4
0
        public Segment2D[] GetUncommonSegments(Face2D face)
        {
            var t0 = triangle;
            var t1 = face.Triangle;

            if (t1.HasSegment(t0.s0))
            {
                return(new Segment2D[] { t0.s1, t0.s2 });
            }
            else if (t1.HasSegment(t0.s1))
            {
                return(new Segment2D[] { t0.s0, t0.s2 });
            }
            return(new Segment2D[] { t0.s0, t0.s1 });
        }
Пример #5
0
        public Vertex2D GetUncommonPoint(Face2D face)
        {
            var t0 = triangle;
            var t1 = face.Triangle;

            if (!t1.HasPoint(t0.a))
            {
                return(t0.a);
            }
            else if (!t1.HasPoint(t0.b))
            {
                return(t0.b);
            }
            return(t0.c);
        }
Пример #6
0
        /*
         * The chordal axis is obtained by connecting the midpoints of the internal edges.
         */
        protected Chord2D GetChordalAxis(Face2D external, List <Face2D> faces)
        {
            var t = external.Triangle;

            Vertex2D  src, dst;
            Segment2D dstEdge;

            bool e0 = ExternalSegment(t.s0);
            bool e1 = ExternalSegment(t.s1);
            bool e2 = ExternalSegment(t.s2);

            if (e0 && e1)
            {
                src     = t.s0.HasPoint(t.s1.a) ? t.s1.a : t.s1.b;
                dst     = triangulation.CheckAndAddVertex(t.s2.Midpoint());
                dstEdge = t.s2;
            }
            else if (e1 && e2)
            {
                src     = t.s1.HasPoint(t.s2.a) ? t.s2.a : t.s2.b;
                dst     = triangulation.CheckAndAddVertex(t.s0.Midpoint());
                dstEdge = t.s0;
            }
            else
            {
                src     = t.s2.HasPoint(t.s0.a) ? t.s0.a : t.s0.b;
                dst     = triangulation.CheckAndAddVertex(t.s1.Midpoint());
                dstEdge = t.s1;
            }

            var chord = new Chord2D(src, dst, external);

            chord.SetDstEdge(dstEdge);

            var connection = new Connection2D(faces);

            ChordalAxisRoutine(chord, connection);

            return(chord);
        }
Пример #7
0
 public void Remove(Face2D f)
 {
     connections[f.Triangle.s0].Remove(f);
     connections[f.Triangle.s1].Remove(f);
     connections[f.Triangle.s2].Remove(f);
 }
Пример #8
0
 public void Add(Face2D f)
 {
     CheckAndAdd(f.Triangle.s0, f);
     CheckAndAdd(f.Triangle.s1, f);
     CheckAndAdd(f.Triangle.s2, f);
 }
Пример #9
0
 public Neighbor2D(Face2D f, Segment2D s)
 {
     face  = f;
     joint = s;
 }