void do_quad(char *line) { int element_id; int pt1, pt2, pt3, pt4; fastf_t thick = 0.0; int pos = 0; bu_strlcpy(field, &line[8], sizeof(field)); element_id = atoi( field ); if ( debug ) bu_log( "do_quad: %s\n", line ); if ( !bot ) bot = element_id; if ( faces == NULL ) { faces = (int *)bu_malloc( GRID_BLOCK*3*sizeof( int ), "faces" ); thickness = (fastf_t *)bu_malloc( GRID_BLOCK*sizeof( fastf_t ), "thickness" ); facemode = (char *)bu_malloc( GRID_BLOCK*sizeof( char ), "facemode" ); face_size = GRID_BLOCK; face_count = 0; } bu_strlcpy(field, &line[24], sizeof(field)); pt1 = atoi( field ); bu_strlcpy(field, &line[32], sizeof(field)); pt2 = atoi( field ); bu_strlcpy(field, &line[40], sizeof(field)); pt3 = atoi( field ); bu_strlcpy(field, &line[48], sizeof(field)); pt4 = atoi( field ); if ( mode == PLATE_MODE ) { bu_strlcpy(field, &line[56], sizeof(field)); thick = atof( field ) * 25.4; bu_strlcpy(field, &line[64], sizeof(field)); pos = atoi( field ); if ( pos == 0 ) /* use default */ pos = POS_FRONT; if ( pos != POS_CENTER && pos != POS_FRONT ) { bu_log( "do_quad: illegal postion parameter (%d), must be one or two\n", pos ); bu_log( "\telement %d, component %d, group %d\n", element_id, comp_id, group_id ); return; } } Add_bot_face( pt1, pt2, pt3, thick, pos ); Add_bot_face( pt1, pt3, pt4, thick, pos ); }
static void do_tri(char *line) { int element_id; int pt1, pt2, pt3; fastf_t thick; int pos; if (debug) bu_log("do_tri: %s\n", line); bu_strlcpy(field, &line[8], sizeof(field)); element_id = atoi(field); if (!bot) bot = element_id; if (faces == NULL) { if (bu_debug&BU_DEBUG_MEM_CHECK && bu_mem_barriercheck()) bu_log("memory corrupted before malloc of faces\n"); faces = (int *)bu_malloc(GRID_BLOCK*3*sizeof(int), "faces"); thickness = (fastf_t *)bu_malloc(GRID_BLOCK*sizeof(fastf_t), "thickness"); facemode = (char *)bu_malloc(GRID_BLOCK*sizeof(char), "facemode"); face_size = GRID_BLOCK; face_count = 0; if (bu_debug&BU_DEBUG_MEM_CHECK && bu_mem_barriercheck()) bu_log("memory corrupted after malloc of faces, thickness, and facemode\n"); } bu_strlcpy(field, &line[24], sizeof(field)); pt1 = atoi(field); bu_strlcpy(field, &line[32], sizeof(field)); pt2 = atoi(field); bu_strlcpy(field, &line[40], sizeof(field)); pt3 = atoi(field); thick = 0.0; pos = 0; if (mode == PLATE_MODE) { bu_strlcpy(field, &line[56], sizeof(field)); thick = atof(field) * 25.4; bu_strlcpy(field, &line[64], sizeof(field)); pos = atoi(field); if (pos == 0) pos = POS_FRONT; if (debug) bu_log("\tplate mode: thickness = %f\n", thick); } if (bu_debug&BU_DEBUG_MEM_CHECK && bu_mem_barriercheck()) bu_log("memory corrupted before call to Add_bot_face()\n"); Add_bot_face(pt1, pt2, pt3, thick, pos); if (bu_debug&BU_DEBUG_MEM_CHECK && bu_mem_barriercheck()) bu_log("memory corrupted after call to Add_bot_face()\n"); }