void main() { int arr[7] = {2,2,3,3,3,2,6}, n, i; n = removeRepeated(arr, 7); for(i=0 ; i<n ; i++) { printf("%d, ", arr[i]); } printf("\n"); }
int main (){ int continueExecution=1; /* INITIALIZING THE ROUTES POPULATION */ route *way [routeQtd]; int i=0; for (i=0 ; i<routeQtd ; i++){ way[i] = initialize(); } /* INITIALIZATION ENDS */ evaluateFitness (way); show (way); printf ("Do you want to continue route crossover? 1-yes, 0-no "); scanf ("%d", &continueExecution); int contGeracoes = 1; //initializing generations counter while (continueExecution == 1){ printf ("Generation %d:\n\n", contGeracoes); makeCrosover (way); makeElitism (way); removeRepeated (way); updateTotalLatencies (way); evaluateFitness (way); show (way); contGeracoes++; printf ("Do you want to continue route crossover? 1-yes, 0-no "); scanf ("%d", &continueExecution); printf ("\n\n"); } return 0; }
void Slicer::slicing(QList<Triangle3D> *model) { int n = 0; // qDebug() << "Start Slicing\n"; if(drawOutline) { if(!outsideOutline && !insideOutline) { QMessageBox::about(0, "Ошибка", "Укажите параметр внешней обводки"); return; } } double currHeight = 0.0; while(currHeight <= height) { slice_byLine->clear(); /* qDebug() << "Slice at " << currHeight << height << ":\n"; qDebug() << "size(slice)" << slice->size() * sizeof(Point2D); qDebug() << "size(slice_byLine)" << slice_byLine->size() * sizeof(Line2D); qDebug() << "size(points)" << points->size() * sizeof(Point2D); qDebug() << "size(one_level)" << one_level->size() * sizeof(poid); qDebug() << "size(model)" << model->size() * sizeof(Triangle3D);*/ GCodeOutStream << "Slice at " << currHeight << ":\r\n"; for(int i = 0; i < model->size(); i++) { points->clear(); if(points->isEmpty()) { solveRelation(model->at(i).vertexes_p1, model->at(i).vertexes_p2, currHeight); solveRelation(model->at(i).vertexes_p2, model->at(i).vertexes_p3, currHeight); solveRelation(model->at(i).vertexes_p3, model->at(i).vertexes_p1, currHeight); if(points->size() == 2) { Line2D line(points->at(0), points->at(1)); *slice_byLine += line; } } else { qDebug() << "********"; } } if(slice_byLine->isEmpty()) { break; } removeEqual(); removeRepeated(); removeReverseRepeated(); while(!slice_byLine->isEmpty()) { // qDebug() << "1"; start = findMin(); slice->clear(); buildOrder(); if(!slice->at(0).isBiggerCorner(slice->at(slice->size() - 1))) { reverseDirection(); } // qDebug() << "size slice =" << sizeof(slice); if(slice->size() > 1) { if(drawOutline) { if(insideOutline) { GCodeOutStream << "\tOutline shading - inside option:\r\n"; edgeShading(lineWidth, true, currHeight, impulse); } else if(outsideOutline) { GCodeOutStream << "\tOutline shading - outside option:\r\n"; edgeShading(lineWidth, false, currHeight, impulse); } } } if(slice->size() > 2) { if(drawInline) { GCodeOutStream << "\tInner shading:\r\n"; maxY = findMaxY(); innerShading(currHeight, impulse, scale); } } } currHeight += step_Z; } GCodeOut.close(); QMessageBox::about(0, "Прогресс", "Печать прошла успешно!"); }