movie command line arguments
This commit is contained in:
parent
a8b4bb7c2c
commit
78769593a7
77
main.c
77
main.c
@ -11,6 +11,7 @@
|
||||
#include "linalg.h"
|
||||
|
||||
#define TOGGLE(a) do { (a) = !(a); } while(0)
|
||||
#define SIGN(x) ((x) > 0 ? 1.0 : -1.0)
|
||||
|
||||
DrawingContext *screen_context;
|
||||
|
||||
@ -33,6 +34,14 @@ void setupContext(DrawingContext *ctx, int argc, char *argv[])
|
||||
ctx->parameter2 = atof(argv[8]);
|
||||
else
|
||||
ctx->parameter2 = 1.0;
|
||||
if(argc > 12) {
|
||||
ctx->movie_filename = argv[9];
|
||||
ctx->movie_parameter_duration = atof(argv[10]);
|
||||
ctx->movie_parameter2_duration = atof(argv[11]);
|
||||
ctx->movie_n_frames = atoi(argv[12]);
|
||||
} else {
|
||||
ctx->movie_n_frames = 0;
|
||||
}
|
||||
// ctx->parameter = 2.77;
|
||||
// ctx->parameter = 0.1;
|
||||
ctx->show_boxes = 0;
|
||||
@ -44,10 +53,10 @@ void setupContext(DrawingContext *ctx, int argc, char *argv[])
|
||||
ctx->show_dual_limit = 0;
|
||||
ctx->show_text = 1;
|
||||
ctx->mode = 0;
|
||||
ctx->use_rotation_basis = 2;
|
||||
ctx->use_rotation_basis = 1;
|
||||
ctx->limit_with_lines = 0;
|
||||
ctx->use_repelling = 0;
|
||||
ctx->show_marking = 1;
|
||||
ctx->show_marking = 0;
|
||||
ctx->marking.x = -0.73679;
|
||||
ctx->marking.y = -0.01873;
|
||||
ctx->show_coxeter_orbit = 0;
|
||||
@ -158,8 +167,9 @@ void updateMatrices(DrawingContext *ctx)
|
||||
cartanMatrix(ctx->cartan, angle[0], angle[1], angle[2], ctx->parameter);
|
||||
|
||||
gsl_matrix *tmp = getTempMatrix(ctx->ws);
|
||||
int nmodes = 5;
|
||||
|
||||
if(ctx->use_rotation_basis % 5 == 0) {
|
||||
if(ctx->use_rotation_basis % nmodes == 0) {
|
||||
gsl_matrix_set(tmp, 0, 0, 0.0);
|
||||
gsl_matrix_set(tmp, 0, 1, sqrt(3.0)/2.0);
|
||||
gsl_matrix_set(tmp, 0, 2, -sqrt(3.0)/2.0);
|
||||
@ -170,12 +180,22 @@ void updateMatrices(DrawingContext *ctx)
|
||||
gsl_matrix_set(tmp, 2, 1, 1.0);
|
||||
gsl_matrix_set(tmp, 2, 2, 1.0);
|
||||
gsl_matrix_memcpy(ctx->cob, tmp);
|
||||
} else if(ctx->use_rotation_basis % 5 == 1) {
|
||||
} else if(ctx->use_rotation_basis % nmodes == 1) {
|
||||
gsl_matrix_set(tmp, 0, 0, 1.0);
|
||||
gsl_matrix_set(tmp, 0, 1, -1.0);
|
||||
gsl_matrix_set(tmp, 0, 2, 0.0);
|
||||
gsl_matrix_set(tmp, 1, 0, 1.0);
|
||||
gsl_matrix_set(tmp, 1, 1, 1.0);
|
||||
gsl_matrix_set(tmp, 1, 2, 0.0);
|
||||
gsl_matrix_set(tmp, 2, 0, 0.0);
|
||||
gsl_matrix_set(tmp, 2, 1, 0.0);
|
||||
gsl_matrix_set(tmp, 2, 2, 1.0);
|
||||
gsl_matrix_memcpy(ctx->cob, ctx->cartan); // is this a good choice of basis for any reason?
|
||||
} else if(ctx->use_rotation_basis % 5 == 2) {
|
||||
multiply_left(tmp, ctx->cob, ctx->ws);
|
||||
} else if(ctx->use_rotation_basis % nmodes == 2) {
|
||||
computeRotationMatrixFrame(ctx, tmp, "C");
|
||||
invert(tmp, ctx->cob, ctx->ws);
|
||||
} else if(ctx->use_rotation_basis % 5 == 3) {
|
||||
} else if(ctx->use_rotation_basis % nmodes == 3) {
|
||||
computeBoxTransform(ctx, "acb", "cba", ctx->cob);
|
||||
// computeBoxTransform(ctx, "cab", "bca", ctx->cob);
|
||||
// computeBoxTransform(ctx, "acb", "cba", ctx->cob);
|
||||
@ -262,21 +282,33 @@ int processEvent(GraphicsInfo *info, XEvent *ev)
|
||||
|
||||
switch(key) {
|
||||
case XK_Down:
|
||||
if(ev->xkey.state & ShiftMask)
|
||||
screen_context->parameter /= exp(0.00005);
|
||||
else
|
||||
screen_context->parameter /= exp(0.002);
|
||||
updateMatrices(screen_context);
|
||||
computeLimitCurve(screen_context);
|
||||
break;
|
||||
case XK_Up:
|
||||
if(ev->xkey.state & ShiftMask)
|
||||
screen_context->parameter *= exp(0.00005);
|
||||
else
|
||||
screen_context->parameter *= exp(0.002);
|
||||
updateMatrices(screen_context);
|
||||
computeLimitCurve(screen_context);
|
||||
break;
|
||||
case XK_Left:
|
||||
if(ev->xkey.state & ShiftMask)
|
||||
screen_context->parameter2 /= exp(0.00005);
|
||||
else
|
||||
screen_context->parameter2 /= exp(0.002);
|
||||
updateMatrices(screen_context);
|
||||
computeLimitCurve(screen_context);
|
||||
break;
|
||||
case XK_Right:
|
||||
if(ev->xkey.state & ShiftMask)
|
||||
screen_context->parameter2 *= exp(0.00005);
|
||||
else
|
||||
screen_context->parameter2 *= exp(0.002);
|
||||
updateMatrices(screen_context);
|
||||
computeLimitCurve(screen_context);
|
||||
@ -346,37 +378,18 @@ int processEvent(GraphicsInfo *info, XEvent *ev)
|
||||
print(screen_context);
|
||||
break;
|
||||
case 'M':
|
||||
/*
|
||||
screen_context->limit_with_lines = 0;
|
||||
double parameter_start = screen_context->parameter;
|
||||
for(int i = 0; i <= 1300; i++) {
|
||||
if(i < 400)
|
||||
screen_context->parameter = exp(log(parameter_start)+0.002*i);
|
||||
else if(i < 500)
|
||||
screen_context->parameter = exp(log(parameter_start)+0.002*400);
|
||||
else
|
||||
screen_context->parameter = exp(log(parameter_start)+0.002*(900-i));
|
||||
double parameter2_start = screen_context->parameter2;
|
||||
for(int i = 0; i <= screen_context->movie_n_frames; i++) {
|
||||
screen_context->parameter = SIGN(parameter_start)*exp(log(fabs(parameter_start)) +
|
||||
i*screen_context->movie_parameter_duration/screen_context->movie_n_frames);
|
||||
screen_context->parameter2 = SIGN(parameter2_start)*exp(log(fabs(parameter2_start)) +
|
||||
i*screen_context->movie_parameter2_duration/screen_context->movie_n_frames);
|
||||
updateMatrices(screen_context);
|
||||
computeLimitCurve(screen_context);
|
||||
draw(screen_context);
|
||||
sprintf(filename, "movie3/test%03d.png", i);
|
||||
cairo_surface_write_to_png(info->buffer_surface, filename);
|
||||
printf("Finished drawing %s\n", filename);
|
||||
}
|
||||
*/
|
||||
screen_context->limit_with_lines = 0;
|
||||
double parameter_start = screen_context->parameter;
|
||||
for(int i = 0; i <= 1300; i++) {
|
||||
if(i < 400)
|
||||
screen_context->parameter = exp(0.003*i);
|
||||
else if(i < 500)
|
||||
screen_context->parameter = exp(0.003*400);
|
||||
else
|
||||
screen_context->parameter = exp(0.003*(900-i));
|
||||
updateMatrices(screen_context);
|
||||
computeLimitCurve(screen_context);
|
||||
draw(screen_context);
|
||||
sprintf(filename, "movie5/test%03d.png", i);
|
||||
sprintf(filename, "output/%s%03d.png", screen_context->movie_filename, i);
|
||||
cairo_surface_write_to_png(info->buffer_surface, filename);
|
||||
printf("Finished drawing %s\n", filename);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user