TriangleNet.Mesh.DummyInit C# (CSharp) Method

DummyInit() private method

Initialize the triangle that fills "outer space" and the omnipresent subsegment.
The triangle that fills "outer space," called 'dummytri', is pointed to by every triangle and subsegment on a boundary (be it outer or inner) of the triangulation. Also, 'dummytri' points to one of the triangles on the convex hull (until the holes and concavities are carved), making it possible to find a starting triangle for point location. The omnipresent subsegment, 'dummysub', is pointed to by every triangle or subsegment that doesn't have a full complement of real subsegments to point to. 'dummytri' and 'dummysub' are generally required to fulfill only a few invariants: their vertices must remain NULL and 'dummytri' must always be bonded (at offset zero) to some triangle on the convex hull of the mesh, via a boundary edge. Otherwise, the connections of 'dummytri' and 'dummysub' may change willy-nilly. This makes it possible to avoid writing a good deal of special-case code (in the edge flip, for example) for dealing with the boundary of the mesh, places where no subsegment is present, and so forth. Other entities are frequently bonded to 'dummytri' and 'dummysub' as if they were real mesh entities, with no harm done.
private DummyInit ( ) : void
return void
        private void DummyInit()
        {
            // Set up 'dummytri', the 'triangle' that occupies "outer space."
            dummytri = new Triangle();
            dummytri.hash = -1;
            dummytri.id = -1;

            // Initialize the three adjoining triangles to be "outer space." These
            // will eventually be changed by various bonding operations, but their
            // values don't really matter, as long as they can legally be
            // dereferenced.
            dummytri.neighbors[0].triangle = dummytri;
            dummytri.neighbors[1].triangle = dummytri;
            dummytri.neighbors[2].triangle = dummytri;

            if (behavior.useSegments)
            {
                // Set up 'dummysub', the omnipresent subsegment pointed to by any
                // triangle side or subsegment end that isn't attached to a real
                // subsegment.
                dummysub = new Segment();
                dummysub.hash = -1;

                // Initialize the two adjoining subsegments to be the omnipresent
                // subsegment. These will eventually be changed by various bonding
                // operations, but their values don't really matter, as long as they
                // can legally be dereferenced.
                dummysub.subsegs[0].seg = dummysub;
                dummysub.subsegs[1].seg = dummysub;

                // Initialize the three adjoining subsegments of 'dummytri' to be
                // the omnipresent subsegment.
                dummytri.subsegs[0].seg = dummysub;
                dummytri.subsegs[1].seg = dummysub;
                dummytri.subsegs[2].seg = dummysub;
            }
        }