Ejemplo n.º 1
0
        public void silhouette(int index, VInt3 w, VInt3[] aBuf, VInt3[] bBuf, EdgeBuffer edgeBuffer, DeferredIDPoolBase manager)
        {
            Edge[] stack = new Edge[64];
            stack[0] = new Edge(this, index);
            int size = 1;

            while (size-- > 0)
            {
                Facet f = stack[size].m_facet;
                index = stack[size].m_index;

                if (!f.m_obsolete)
                {
                    VFixedPoint pointPlaneDist = f.getPlaneDist(w, aBuf, bBuf);
                    if (pointPlaneDist < VFixedPoint.Zero)
                    {
                        edgeBuffer.Insert(f, index);
                    }
                    else
                    {
                        f.m_obsolete = true; // Facet is visible from w
                        int next  = (index + 1) % 3;
                        int next2 = (next + 1) % 3;
                        stack[size++] = new Edge(f.m_adjFacets[next2], f.m_adjEdges[next2]);
                        stack[size++] = new Edge(f.m_adjFacets[next], f.m_adjEdges[next]);

                        if (!f.m_inHeap)
                        {
                            manager.deferredFreeID(f.m_FacetId);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
 //performs a flood fill over the boundary of the current polytope.
 public void silhouette(VInt3 w, VInt3[] aBuf, VInt3[] bBuf, EdgeBuffer edgeBuffer, DeferredIDPoolBase manager)
 {
     m_obsolete = true;
     for (int a = 0; a < 3; ++a)
     {
         m_adjFacets[a].silhouette(m_adjEdges[a], w, aBuf, bBuf, edgeBuffer, manager);
     }
 }