struct master_item* create_sane_shape(void) { struct master_item *list = create_shape(); struct master_item *shape = list->next; free(list); ___sl_plot(NULL); return shape; }
static void emit_spiral(bool inner) { double mod; Vector3d *tmp; Vector3d translate; int i; /* initial; buffer setup */ g_shape = g_vector_buffer[0]; g_target = g_vector_buffer[1]; /* create shape */ create_shape(inner ? MARBLE_RUN_SEGMENT_HEIGHT/2 : MARBLE_RUN_SEGMENT_HEIGHT/2+MARBLE_RUN_WALL ); /* remember start */ if(inner) memcpy(g_vector_inner[0], g_shape, sizeof(g_vector_inner[0])); else emit_cap(g_vector_inner[0], g_shape, true); /* emit sculpture */ translate = Vector3d::UnitZ()*(MARBLE_RUN_SEGMENT_HEIGHT+MARBLE_RUN_WALL)/MARBLE_RUN_RESOLUTION; for(i=0; i<(6*MARBLE_RUN_RESOLUTION); i++) { if(inner) mod = sin(i*M_PI/(((i / ((MARBLE_RUN_RESOLUTION)/10)) % 4)+1.5))/7; else mod = 0; /* translate all points */ translate_shape(translate, mod); /* emit resulting layer */ emit_stl_layer(inner); /* move to next layer */ tmp = g_shape; g_shape = g_target; g_target = tmp; } /* remember end */ if(inner) memcpy(g_vector_inner[1], g_shape, sizeof(g_vector_inner[1])); else emit_cap(g_vector_inner[1], g_shape, false); }
_shape_book* create_box_system(int num, int per_line) { _shape_book *shape_book = calloc(sizeof(_shape_book), 1); shape_book->t_blocade = num; shape_book->n_blocade = num; shape_book->per_line = per_line; int i, j=0, starty, startx; for (i=0; i<num; i++) { gen_start_coords(per_line, j, &starty, &startx, SHAPE_BOX); shape_book->shape_ptr[i] = create_shape(8, 8, starty, startx, SHAPE_BOX); if (++j == per_line) j=0; } return shape_book; }
int main() { struct node *shape = create_shape(); ___sl_plot(NULL, &shape); while (shape) { struct node *next = shape->next; struct data *data = shape->data; if (data) { free(data->text); free(data); } free(shape); shape = next; } return 0; }
void tri_grid::initialize(SHAPE initial_shape, ncdata* nc_input_data, int max_pts, int max_levs, int max_its, int perim) { max_lev_input = max_levs; // initialise the eight or twelve quad trees with the icosahedron or octahedron // vertices assert(initial_shape == ICOSAHEDRON || initial_shape == OCTAHEDRON || initial_shape == DYMAXION); create_shape(initial_shape, 1.0); assign_points_from_grid(nc_input_data, perim); split_triangles(max_pts, max_levs); if (max_its != 0) PC.equalise(max_its, get_max_level()); build_adjacency_maps(); fill_index_holes(); build_ds_indices(); // build the metadata std::stringstream ss; meta_data["input_grid_file_name"] = nc_input_data->get_file_name(); meta_data["input_grid_var_name"] = nc_input_data->get_file_name(); switch(initial_shape) { case ICOSAHEDRON: meta_data["initial_shape"] = "icosahedron"; break; case OCTAHEDRON: meta_data["initial_shape"] = "octahedron"; break; case DYMAXION: meta_data["initial_shape"] = "dymaxion"; break; } ss << max_levs; meta_data["maximum_levels"] = ss.str(); ss.str(""); ss << max_pts; meta_data["maximum_points"] = ss.str(); ss.str(""); ss << max_its; meta_data["maximum_iterations"] = ss.str(); }
//--------------------------------------------------------------------------------------- int LyricEngraver::create_shapes(Color color) { m_color = color; list< pair<ImoLyric*, GmoShape*> >::iterator it; int i = 0; for(it=m_lyrics.begin(); it != m_lyrics.end(); ++it, ++i) { ImoLyric* pLyric = dynamic_cast<ImoLyric*>(it->first); GmoShapeNote* pNoteShape = dynamic_cast<GmoShapeNote*>(it->second); GmoShapeNote* pNextNoteShape = NULL; list< pair<ImoLyric*, GmoShape*> >::iterator nextIt = it; ++nextIt; if (nextIt != m_lyrics.end()) pNextNoteShape = dynamic_cast<GmoShapeNote*>(nextIt->second); create_shape(i, pNoteShape, pLyric, pNextNoteShape); } return int(m_lyrics.size()); };
//hlavni funkce starajici se o chod aplikace int main(int argc, char **argv ) { unsigned int cnt = 0,old_score=1; char_cnt = 0; last_ch = 0; //iniciaizace HW initialize_hardware(); keyboard_init(); int random_number,i,j; Tshape myshape; Tmatrix matrix,pane,pom; int pom_matrix[8][8] = {0}; char c=0; int latest_line; //srand(2); //vytvoreni noveho utvaru myshape = create_shape(rand()%8); //posun na zacatek matrix = move_it(myshape,pom_matrix); //ulozeni noveho utvaru pane = save_it(matrix,pom_matrix); set_led_d6(1); // rozsviceni D6 set_led_d5(1); // rozsviceni D5 //inicializace LED displeje P6DIR=0xff; P4DIR=0x0f; P2DIR=0xf0; P4OUT=0x00; P2OUT=0x00; P6OUT=0xff; while (1) { delay_ms(1); cnt++; //pri zmacknuti klavesy if (c!=last_ch){ c=last_ch; //pokud byla zmacknuta 6 if (c=='6'){ //posunu se x++; //pokusim se ulozit na to misto utvar matrix = move_it(myshape,pom_matrix); //pokud nelze ulozit if (matrix.count!=4){ //vratim se x--; //a ulozim matrix = move_it(myshape,pom_matrix); } } //pri zmacknuti 4 else if (c=='4'){ //posunu se x--; //pokusim se ulozit matrix = move_it(myshape,pom_matrix); //pokud bych vypsal mene jak 4 znaky z utvaru if (matrix.count!=4){ //posouvam se zpatky x++; matrix = move_it(myshape,pom_matrix); } } //pokud nactu 8 else if (c=='8'){ //posunu se y++; //pokusim se ulozit matrix = move_it(myshape,pom_matrix); if (matrix.count!=4){ //pokud nelze posun, posunu se nazpet y--; matrix = move_it(myshape,pom_matrix); matrix.last_line = 1; } } //rotace else if (c=='5'){ //pouzivam prvne rotate_back kvuli "hezci" rotaci myshape = rotate_back(myshape); //pokusim se ulozit dany utvar matrix = move_it(myshape,pom_matrix); //pokud pri posunu nelze vypsat vsechny 4 prvky daneho utvaru if (matrix.count!=4){ //posunu se zpatky myshape = rotate(myshape); matrix = move_it(myshape,pom_matrix); } } else { continue; } //ulozim do vysledneho hraciho pole pane = save_it(matrix,pom_matrix); //pokud jsem nacetl posledni radek if (matrix.last_line==1) { //ulozim si hraci pole do pomocne matice for (i=0;i<8;i++) { for (j=0;j<8;j++) { pom_matrix[i][j] = pane.shape[i][j]; } } matrix.last_line=0; //smazu radky pane=delete_rows(pane); x=0; y=0; //vygeneruji novy utvar myshape = create_shape(rand()%8); int i,t; //ulozim do pomocne matice hraci pole for (i=0;i<8;i++) for (t=0;t<8;t++) pom_matrix[i][t]=pane.shape[i][t]; //posunu nove vygenerovany utvar na zacatek hraciho pole matrix = move_it(myshape,pom_matrix); //ulozim tento stav pane = save_it(matrix,pom_matrix); } c=last_ch; } //tisknuti skore if (old_score!=score && (cnt%100)==0){ old_score=score; print_score("Score: "); } if (cnt > 1000) { cnt = 0; flip_led_d6(); // negace portu na ktere je LED } print_it(pane.shape); keyboard_idle(); // obsluha klavesnice terminal_idle(); // obsluha terminalu } return 0; }
static NATIVECALL(shape_new){ Link link = create_shape(); View v = This->value.vptr; im_append(v->items, link); return link; }