コード例 #1
0
        public static (SG s1, SG s2, SG s3, DN n1, DN n2, DN n3) Split(DN n, V2 p)
        {
            var t = n.triangle;

            if (t.Includes(p, false))
            {
                var ab = new DN(t.a, t.b, p);
                var bc = new DN(t.b, t.c, p);
                var ca = new DN(t.c, t.a, p);
                ab.neighbor = new List <DN> {
                    bc, ca
                };
                bc.neighbor = new List <DN> {
                    ca, ab
                };
                ca.neighbor = new List <DN> {
                    ab, bc
                };
                n.SetNeighbors(ab, t.a, t.b);
                n.SetNeighbors(bc, t.b, t.c);
                n.SetNeighbors(ca, t.c, t.a);
                return(new SG(t.a, t.b), new SG(t.b, t.c), new SG(t.c, t.a), ab, bc, ca);
            }
            else
            {
                throw new Exception("degenerated case like points on edge");
            }
        }