Exemple #1
0
        public bool UpdateLink(int tri1, int tri2, int ref0, int ref1)
        {
            AdjTriangle t1 = Faces[tri1];
            AdjTriangle t2 = Faces[tri2];

            byte edge0 = t1.FindEdge(ref0, ref1); if (edge0 == 255)
            {
                return(false);
            }
            byte edge1 = t2.FindEdge(ref0, ref1); if (edge1 == 255)

            {
                return(false);
            }

            t1.Tri[edge0] = tri2; // | ((int)edge1 << 30);
            t2.Tri[edge1] = tri1; // | ((int)edge0 << 30);

            return(true);
        }
Exemple #2
0
        public void AddTriangle(int a, int b, int c)
        {
            Faces[currentFace]        = new AdjTriangle();
            Faces[currentFace].Ref[0] = a;
            Faces[currentFace].Ref[1] = b;
            Faces[currentFace].Ref[2] = c;

            Faces[currentFace].Tri[0] = -1;
            Faces[currentFace].Tri[1] = -1;
            Faces[currentFace].Tri[2] = -1;

            if (a < b)
            {
                AddEdge(a, b, currentFace);
            }
            else
            {
                AddEdge(b, a, currentFace);
            }

            if (a < c)
            {
                AddEdge(a, c, currentFace);
            }
            else
            {
                AddEdge(c, a, currentFace);
            }

            if (b < c)
            {
                AddEdge(b, c, currentFace);
            }
            else
            {
                AddEdge(c, b, currentFace);
            }

            currentFace++;
        }