[brlcad-commits] SF.net SVN: brlcad:[38285] brlcad/trunk/src/conv/obj-g_new.c
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <r_...@us...> - 2010-03-31 21:36:57
|
Revision: 38285 http://brlcad.svn.sourceforge.net/brlcad/?rev=38285&view=rev Author: r_weiss Date: 2010-03-31 21:36:48 +0000 (Wed, 31 Mar 2010) Log Message: ----------- more rework for nmg Modified Paths: -------------- brlcad/trunk/src/conv/obj-g_new.c Modified: brlcad/trunk/src/conv/obj-g_new.c =================================================================== --- brlcad/trunk/src/conv/obj-g_new.c 2010-03-31 20:52:14 UTC (rev 38284) +++ brlcad/trunk/src/conv/obj-g_new.c 2010-03-31 21:36:48 UTC (rev 38285) @@ -207,9 +207,14 @@ size_t groupid = 0; size_t numNorTriangles_in_current_bot = 0; /* NMG2s */ + const size_t ***index_arr_nv_faces_history = NULL ; + const size_t ***index_arr_nv_faces_history_tmp = NULL ; + size_t *size_history = NULL ; + size_t *size_history_tmp = NULL ; + size_t history_arrays_size = 0; size_t numNorPolygons_in_current_nmg = 0; size_t numNorPolygonVertices_in_current_nmg = 0 ; - struct my_verts *nmg_verts; /* array of structures holding coordinates and normals */ + struct my_verts *nmg_verts; /* array of structures holding coordinates and normals */ struct my_verts *nmg_verts_tmp; struct bu_ptbl vertices2; /* table of vertices for one face */ struct bu_ptbl faces2; /* table of faces for one element */ @@ -270,6 +275,18 @@ /* allocate memory for initial nmg_verts array of structures */ nmg_verts = (struct my_verts *)bu_calloc(nmg_verts_size, sizeof(struct my_verts), "nmg_verts"); + + /* initial number of history elements to create, one is required + for each polygon in the current nmg */ + history_arrays_size = 128 ; + + /* allocate memory for initial index_arr_nv_faces_history array */ + index_arr_nv_faces_history = (const size_t ***)bu_calloc(history_arrays_size, + sizeof(size_t *) * 2, + "index_arr_nv_faces_history"); + + /* allocate memory for initial size_history array */ + size_history = (size_t *)bu_calloc(history_arrays_size, sizeof(size_history), "size_history"); /* NMG2e */ /* compute memory required for initial triangle_indexes array */ @@ -340,6 +357,28 @@ /* is in the current group */ if ( found ) { size = obj_polygonal_nv_face_vertices(ga->contents,i,&index_arr_nv_faces); + + /* NMG2s */ + index_arr_nv_faces_history[numNorPolygons_in_current_nmg][0] = index_arr_nv_faces[0]; + index_arr_nv_faces_history[numNorPolygons_in_current_nmg][1] = index_arr_nv_faces[1]; + + size_history[numNorPolygons_in_current_nmg] = size; + + /* if needed, increase size of index_arr_nv_faces_history and size_history */ + if ( numNorPolygons_in_current_nmg >= history_arrays_size ) { + history_arrays_size = history_arrays_size + 128 ; + + index_arr_nv_faces_history_tmp = bu_realloc(index_arr_nv_faces_history, + sizeof(index_arr_nv_faces_history) * history_arrays_size, + "index_arr_nv_faces_history_tmp"); + index_arr_nv_faces_history = index_arr_nv_faces_history_tmp; + + size_history_tmp = bu_realloc(size_history, sizeof(size_history) * history_arrays_size, + "size_history_tmp"); + size_history = size_history_tmp; + } + /* NMG2e */ + } /* test for and force the skip of degenerate faces */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |