Incomplete work for porting translate()

This commit is contained in:
Alessandro Ranellucci
2013-08-05 10:48:38 +02:00
parent 515d5707c9
commit 04d5d1bb9b
7 changed files with 36 additions and 10 deletions

View File

@@ -23,6 +23,14 @@
#include "stl.h"
void
stl_invalidate_shared_vertices(stl_file *stl)
{
if (stl->v_indices != NULL)
free(stl->v_indices);
if (stl->v_shared != NULL)
free(stl->v_shared);
}
void
stl_generate_shared_vertices(stl_file *stl)
@@ -38,6 +46,9 @@ stl_generate_shared_vertices(stl_file *stl)
int next_facet;
int reversed;
// make sure this function is idempotent and does not leak memory
stl_invalidate_shared_vertices(stl);
stl->v_indices = (v_indices_struct*)
calloc(stl->stats.number_of_facets, sizeof(v_indices_struct));
if(stl->v_indices == NULL) perror("stl_generate_shared_vertices");