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 /*---------------------------------------------------------------------*/
22 ListHead *all_strips[100000]; /* Assume max 100000 strips */
24 void ParseAndFreeList( ListHead *pListHead )
28 /* Freeing a linked list */
29 num = NumOnList(pListHead);
30 for (c = 0; c< num; c++)
34 void FreePolygonNode( PF_VERTS pfVerts)
36 /* Free a vertex node */
37 if ( pfVerts->pPolygon )
38 free( pfVerts->pPolygon );
45 /* Free strips data structure */
46 if (strips[0] == NULL)
49 ParseAndFreeList(strips[0]);
52 void FreeFaceNode( PF_FACES pfFaces)
55 if ( pfFaces->pPolygon )
56 free( pfFaces->pPolygon );
61 void FreeFaceTable(int nSize)
65 for ( nIndex=0; nIndex < nSize; nIndex++ )
67 if ( PolFaces[nIndex] != NULL )
68 ParseAndFreeList( PolFaces[nIndex] );
73 void FreeEdgeTable(int nSize)
77 for ( nIndex=0; nIndex < nSize; nIndex++ )
79 if ( PolEdges[nIndex] != NULL )
80 ParseAndFreeList( PolEdges[nIndex] );
86 void Free_All_Strips()
94 pListHead = all_strips[y];
95 if (pListHead == NULL)
98 ParseAndFreeList(all_strips[y]);
102 void End_Face_Struct(int numfaces)
104 FreeFaceTable(numfaces);
107 void End_Edge_Struct(int numverts)
109 FreeEdgeTable(numverts);