commit
41a06797c1
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
*.tif
|
||||
**/*.tif
|
||||
production/
|
||||
tif_drop/
|
||||
*.mp4
|
||||
**/*.mp4
|
@ -16,10 +16,10 @@
|
||||
/* 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 +28,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 +65,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 +85,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 +107,29 @@
|
||||
|
||||
#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 150 /* number of segments of boundary */
|
||||
#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 OUTER_COLOR 300.0 /* color outside billiard */
|
||||
#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 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 +200,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 +412,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)
|
||||
|
@ -30,10 +30,13 @@
|
||||
#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 XMIN -2.0
|
||||
#define XMAX 2.0 /* x interval */
|
||||
@ -87,10 +90,10 @@
|
||||
#define PRINT_PARTICLE_NUMBER 0 /* set to 1 to print number of particles */
|
||||
#define TEST_ACTIVE 1 /* set to 1 to test whether particle is in billiard */
|
||||
|
||||
#define NSTEPS 1000 /* number of frames of movie */
|
||||
#define TIME 1500 /* time between movie frames, for fluidity of real-time simulation */
|
||||
#define NSTEPS 5000 /* number of frames of movie */
|
||||
#define TIME 400 /* time between movie frames, for fluidity of real-time simulation */
|
||||
// #define DPHI 0.00001 /* integration step */
|
||||
#define DPHI 0.000005 /* integration step */
|
||||
#define DPHI 0.00005 /* integration step */
|
||||
#define NVID 150 /* number of iterations between images displayed on screen */
|
||||
|
||||
/* Decreasing TIME accelerates the animation and the movie */
|
||||
|
@ -109,7 +109,8 @@ 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)
|
||||
@ -120,10 +121,10 @@ int writetiff(char *filename, char *description, int x, int y, int width, int he
|
||||
}
|
||||
p += width * sizeof(GLubyte) * 3;
|
||||
}
|
||||
free(image); /* prenvents RAM consumption*/
|
||||
TIFFClose(file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void init() /* initialisation of window */
|
||||
{
|
||||
@ -135,8 +136,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 +171,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 +179,6 @@ void blank()
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
|
||||
void save_frame()
|
||||
{
|
||||
static int counter = 0;
|
||||
@ -193,12 +191,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);
|
||||
|
||||
|
||||
// choose one 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user