/*******************************************************************/ /* Sclicing a parabola shape */ /* Turning operation */ /* C code */ /* (c) U. Burghaus, 2010 */ /**Start************************************************************/ // this program version has no graphics output // this program version has no user friedly data input float StockLength = 2.0; float StockDiameter = 1.5; //Parabola parameters float m = 3.0; float x0 = -1.5; float y0 =0.5; // slicing parameters float StopAt =0.85; float SliceThickness 0.05; // program parameters float xcor; float ParabolaX[100]; float ParabolaY[100]; float SliceLenght[100]; float PlotLength[100]; int NumberOfSlices; // storr last slice table**************************************************** int CVICALLBACK save (...) { // this is not a complete subroutine for (j=0;((j0));j++) { strcat(buffer,""); sprintf(buffer, "#%d %10.3f",j,SliceLenght[j]); fprintf(fd,"%s\n",buffer); } return 0; } // calculate slice table**************************************************** int CVICALLBACK slicing (...) { int i; // slice number switch (event) { case EVENT_COMMIT: // read parameters here or use default values xcor = StockDiameter; i=0; SliceLenght[0]=0; while (xcor > StopAt) { PlotLength[i] = m*(xcor+x0-SliceThickness/2.0)*(xcor+x0-SliceThickness/2.0)+y0; SliceLenght[i] = StockLength - PlotLength[i]; PlotRectangle (...function depends on compiler used ...); xcor = xcor-SliceThickness; i++; } NumberOfSlices = i; break; } return 0; } /**End************************************************************/