1 /********************************************************************/
2 /* STRIPE: converting a polygonal model to triangle strips
5 Advisors: Steven Skiena and Amitabh Varshney
7 /********************************************************************/
9 /*---------------------------------------------------------------------*/
11 This file contains the code used to free the data structures.
13 /*---------------------------------------------------------------------*/
19 void ParseAndFreeList( ListHead *pListHead )
24 /* Freeing a linked list */
25 num = NumOnList(pListHead);
26 for (c = 0; c< num; c++)
27 value = RemHead(pListHead);
30 void FreePolygonNode( PF_VERTS pfVerts)
32 /* Free a vertex node */
33 if ( pfVerts->pPolygon )
34 free( pfVerts->pPolygon );
43 /* Free strips data structure */
44 if (strips[0] == NULL)
47 ParseAndFreeList(strips[0]);
50 void FreeFaceNode( PF_FACES pfFaces)
53 if ( pfFaces->pPolygon )
54 free( pfFaces->pPolygon );
59 void FreeFaceTable(int nSize)
63 for ( nIndex=0; nIndex < nSize; nIndex++ )
65 if ( PolFaces[nIndex] != NULL )
66 ParseAndFreeList( PolFaces[nIndex] );
71 void FreeEdgeTable(int nSize)
75 for ( nIndex=0; nIndex < nSize; nIndex++ )
77 if ( PolEdges[nIndex] != NULL )
78 ParseAndFreeList( PolEdges[nIndex] );
84 void Free_All_Strips()
92 pListHead = all_strips[y];
93 if (pListHead == NULL)
96 ParseAndFreeList(all_strips[y]);
100 void End_Face_Struct(int numfaces)
102 FreeFaceTable(numfaces);
105 void End_Edge_Struct(int numverts)
107 FreeEdgeTable(numverts);