File:SeregaFunction03.png
Revision as of 09:43, 21 June 2013 by Maintenance script (talk | contribs)
Size of this preview: 798 × 138 pixels. Other resolutions: 320 × 55 pixels | 2,509 × 434 pixels.
Original file (2,509 × 434 pixels, file size: 51 KB, MIME type: image/png)
Drawing of the trigonometric approximation of the Serega function
C++ generator of the curve
#include <math.h> #include <stdio.h> #include <stdlib.h> #define DB double #define DO(x,y) for(x=0;x<y;x++)
void ado(FILE *O, int X, int Y) { fprintf(O,"%c!PS-Adobe-2.0 EPSF-2.0\n",'%'); fprintf(O,"%c%cBoundingBox: 0 0 %d %d\n",'%','%',X,Y); fprintf(O,"/M {moveto} bind def\n"); fprintf(O,"/L {lineto} bind def\n"); fprintf(O,"/S {stroke} bind def\n"); fprintf(O,"/s {show newpath} bind def\n"); fprintf(O,"/C {closepath} bind def\n"); fprintf(O,"/F {fill} bind def\n"); fprintf(O,"/times-Roman findfont 20 scalefont setfont\n"); fprintf(O,"/W {setlinewidth} bind def\n"); fprintf(O,"/RGB {setrgbcolor} bind def\n");}
#define M(x,y) fprintf(o,"%8.5f %8.5f M\n",0.+x,0.+y); #define L(x,y) fprintf(o,"%8.5f %8.5f L\n",0.+x,0.+y);
main(){ int n; DB x,y,t,c,s,z; FILE *o; o=fopen("03.eps","w"); ado(o,1204,208); fprintf(o,"602 101 translate 200 200 scale\n"); for(n=-6;n<7;n++) {M(n/2.,-.5)L(n/2.,.5)} for(n=-6;n<7;n++) {M(-3, n/2.)L(3,n/2.)} fprintf(o,".002 W S\n"); DO(n,1260){t=-3.04+.005*n; c=cos(t); s=sin(t); z=1.3-c; z*=z; x=-(t-s-.2/(1.2-c)); y=.2+.1*s+.85*c -.05/z-.003/z/z; y*=.75; if(n==0) M(x,y) else L(x,y) } fprintf(o,"1 setlinejoin .005 W 0 0 1 RGB S\n"); fprintf(o,"showpage\n%c%cTrailer",'%','%'); fclose(o); system("epstopdf 03.eps"); system( "open 03.pdf"); //for macintosh getchar(); system("killall Preview"); //for macintosh }
Refeerences
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 17:50, 20 June 2013 | 2,509 × 434 (51 KB) | Maintenance script (talk | contribs) | Importing image file |
You cannot overwrite this file.
File usage
The following page uses this file: