public List <Primitive> Strip()
        {
            if (!m_FirstRun)
            {
                UnmarkNodes(m_Triangles);
                ResetStripIDs();
                m_Cache.Reset();
                m_TriHeap.Clear();
                m_Candidates.Clear();
                m_StripID = 0;
            }

            InitTriHeap();

            Stripify();
            AddRemainingTriangles();

            m_FirstRun = false;
            return(m_PrimitivesVector.ToList());
        }
        private Strip BackExtendToStrip(uint Start, TriOrder Order, bool ClockWise)
        {
            m_CurrentNodes = new List <ushort>();
            _checkNodes    = true;

            //Begin a new strip
            Triangle tri = m_Triangles[Start].m_Elem;
            uint     b   = LastEdge(tri, Order).B;

            if (TryAddNode(b))
            {
                tri.SetStripID(++m_StripID);
                BackAddIndex(b);
            }
            else
            {
                _checkNodes = false;
                m_CurrentNodes.Clear();
                return(null);
            }

            uint Size = 1;

            GraphArray <Triangle> .Node Node = null;

            //Loop while we can further extend the strip
            for (uint i = Start; !Cache || ((Size + 2) < CacheSize); Size++)
            {
                Node = m_Triangles[i];
                var Link = BackLinkToNeighbour(Node, ClockWise, ref Order);

                //Is it the end of the strip?
                if (Link == null)
                {
                    break;
                }
                else
                {
                    i = (Node = Link.Terminal).m_Elem.m_Index;

                    Node.m_Elem.SetStripID(m_StripID);
                    ClockWise = !ClockWise;
                }
            }

            _checkNodes = false;
            m_CurrentNodes.Clear();

            //We have to start from a counterclockwise triangle.
            //Simply return an empty strip in the case where the first triangle is clockwise.
            //Even though we could discard the first triangle and start from the next counterclockwise triangle,
            //this often leads to more lonely triangles afterward.
            if (ClockWise)
            {
                return(null);
            }

            if (Cache)
            {
                m_Cache.Merge(m_BackCache, Size);
                m_BackCache.Reset();
            }

            return(new Strip(Node.m_Elem.m_Index, Order, Size));
        }