Produce 1080p tiff files

This commit is contained in:
eugene 2021-11-25 18:59:18 +01:00
parent 7748891347
commit 5c876abfa6
2 changed files with 34 additions and 30 deletions

View File

@ -8,18 +8,17 @@
/* line to nils.berglund@univ-orleans.fr - Thanks! */
/* */
/* compile with */
/* gcc -o drop_billiard drop_billiard.c */
/* -O3 -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lXmu -lglut */
/* gcc -o drop_billiard drop_billiard.c -O3 -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lXmu -lglut */
/* */
/* */
/* To make a video, set MOVIE to 1 and create subfolder tif_drop */
/* It may be possible to increase parameter PAUSE */
/* */
/* create movie using */
/* ffmpeg -i part.%05d.tif -vcodec libx264 drop.mp4 */
/* ffmpeg -i tif_drop/part.%05d.tif -vcodec libx264 drop.mp4 */
/* */
/*********************************************************************************/
#include <math.h>
#include <string.h>
#include <GL/glut.h>
@ -28,10 +27,16 @@
#include <sys/types.h>
#include <tiffio.h> /* Sam Leffler's libtiff library. */
#define MOVIE 0 /* set to 1 to generate movie */
#define MOVIE 1 /* set to 1 to generate movie */
#define WINWIDTH 1280 /* window width */
#define WINHEIGHT 720 /* window height */
// #define WINWIDTH 1280 /* window width */
// #define WINHEIGHT 720 /* window height */
#define WINWIDTH 1920 /* window width */
#define WINHEIGHT 1080 /* window height */
// #define WINWIDTH 2560 /* window width */
// #define WINHEIGHT 1440 /* window height */
#define XMIN -2.0
#define XMAX 2.0 /* x interval */
@ -59,7 +64,7 @@
#define NGOLDENSPIRAL 2000 /* max number of points for C_GOLDEN_SPIRAL arrandement */
#define SDEPTH 1 /* Sierpinski gastket depth */
#define LAMBDA 0.3 /* parameter controlling the dimensions of domain */
#define LAMBDA 0.3 /* parameter controlling the dimensions of domain - with 0.5 @1440p it cut out top-bottom borders. 0.4 is @limit */
// #define LAMBDA 1.124950941 /* sin(36°)/sin(31.5°) for 5-star shape with 45° angles */
// #define LAMBDA 1.445124904 /* sin(36°)/sin(24°) for 5-star shape with 60° angles */
// #define LAMBDA 3.75738973 /* sin(36°)/sin(9°) for 5-star shape with 90° angles */
@ -79,7 +84,7 @@
#define NPARTMAX 100000 /* maximal number of particles after resampling */
#define NSTEPS 5000 /* number of frames of movie */
#define TIME 150 /* time between movie frames, for fluidity of real-time simulation */
#define TIME 150 /* time between movie frames, for fluidity of real-time simulation */
#define DPHI 0.0001 /* integration step */
#define NVID 75 /* number of iterations between images displayed on screen */
@ -101,31 +106,32 @@
#define COLOR_PALETTE 1 /* Color palette, see list in global_pdes.c */
#define NCOLORS 14 /* number of colors */
#define NCOLORS 14 /* number of colors */
#define COLORSHIFT 3 /* hue of initial color */
#define RAINBOW_COLOR 0 /* set to 1 to use different colors for all particles */
#define NSEG 100 /* number of segments of boundary */
// #define NSEG 100 /* number of segments of boundary */
#define NSEG 150 /* _eux */
#define BILLIARD_WIDTH 4 /* width of billiard */
#define FRONT_WIDTH 4 /* width of wave front */
#define BLACK 0 /* set to 1 for black background */
#define COLOR_OUTSIDE 0 /* set to 1 for colored outside */
#define BLACK 1 /* set to 1 for black background */
#define COLOR_OUTSIDE 1 /* set to 1 for colored outside */
// #define COLOR_OUTSIDE 0 /* _eux */
#define OUTER_COLOR 300.0 /* color outside billiard */
// #define OUTER_COLOR 0.0 //_eux
#define PAINT_INT 0 /* set to 1 to paint interior in other color (for polygon) */
#define PAINT_EXT 1 /* set to 1 to paint exterior of billiard */
#define PAUSE 1000 /* number of frames after which to pause */
#define PSLEEP 1 /* sleep time during pause */
#define PSLEEP 10 /* sleep time during pause */
#define SLEEP1 1 /* initial sleeping time */
#define SLEEP2 100 /* final sleeping time */
#define END_FRAMES 0 /* number of frames at end of movie */
#define PI 3.141592654
#define PI 3.141592654
#define DPI 6.283185307
#define PID 1.570796327
#include "global_particles.c"
#include "sub_part_billiard.c"
@ -196,8 +202,6 @@ void init_partial_drop_config(int i1, int i2, double x0, double y0, double angle
}
}
int resample(int color[NPARTMAX], double *configs[NPARTMAX])
/* add particles where the front is stretched too thin */
{
@ -410,7 +414,7 @@ void graph_movie(int time, int color[NPARTMAX], double *configs[NPARTMAX])
{
// print_config(configs[i]);
if (configs[i][2]<0.0)
if (configs[i][2]<0.0)
{
vbilliard(configs[i]);
if (!RAINBOW_COLOR)

View File

@ -109,7 +109,7 @@ int writetiff(char *filename, char *description, int x, int y, int width, int he
TIFFSetField(file, TIFFTAG_ROWSPERSTRIP, 1);
TIFFSetField(file, TIFFTAG_IMAGEDESCRIPTION, description);
p = image;
for (i = height - 1; i >= 0; i--)
for (i = height - 1; i >= 0; i--)
{
// if (TIFFWriteScanline(file, p, height - i - 1, 0) < 0)
if (TIFFWriteScanline(file, p, i, 0) < 0)
@ -123,7 +123,6 @@ int writetiff(char *filename, char *description, int x, int y, int width, int he
TIFFClose(file);
return 0;
}
void init() /* initialisation of window */
{
@ -135,8 +134,6 @@ void init() /* initialisation of window */
glOrtho(XMIN, XMAX, YMIN, YMAX , -1.0, 1.0);
}
void rgb_color_scheme(int i, double rgb[3]) /* color scheme */
{
double hue, y, r;
@ -172,7 +169,7 @@ void blank()
if (COLOR_OUTSIDE)
{
hsl_to_rgb(OUTER_COLOR, 0.9, 0.15, rgb);
hsl_to_rgb(OUTER_COLOR, 0.9, 0.15, rgb);
glClearColor(rgb[0], rgb[1], rgb[2], 1.0);
}
else if (BLACK) glClearColor(0.0, 0.0, 0.0, 1.0);
@ -180,7 +177,6 @@ void blank()
glClear(GL_COLOR_BUFFER_BIT);
}
void save_frame()
{
static int counter = 0;
@ -193,12 +189,16 @@ void save_frame()
sprintf(strstr(n2,"."), format, counter);
strcat(n2, ".tif");
printf(" saving frame %s \n",n2);
writetiff(n2, "Billiard in an ellipse", 0, 0,
WINWIDTH, WINHEIGHT, COMPRESSION_LZW);
// mod by eux - chose on of the following according to the comment beside.
writetiff(n2, "Billiard in an ellipse", 0, 0, WINWIDTH, WINHEIGHT-40, COMPRESSION_LZW); /* to use with 1080p in drop_billiard.c- probably the best because it's
generating 1080p image, lighter, and then cropping those 40 pixels to
avoid the strange band*/
// writetiff(n2, "Billiard in an ellipse", 0, 0, WINWIDTH, WINHEIGHT-50, COMPRESSION_LZW); //works for 1080p -> "-50px" band!!!
// writetiff(n2, "Billiard in an ellipse", 0, 0, 1920, 1080-40, COMPRESSION_LZW); //another perfect 1080p from 1440p in setup
// writetiff(n2, "Billiard in an ellipse", -WINWIDTH/8+320, -WINHEIGHT/8+180, WINWIDTH-640, WINHEIGHT-400, COMPRESSION_LZW); // perfect 1040p from 1440p in setup
}
void write_text_fixedwidth( double x, double y, char *st)
{
int l, i;