some new boxes

This commit is contained in:
Florian Stecker 2019-02-08 13:03:05 +01:00
parent 1ec2a49983
commit 3d8378aa16
3 changed files with 77 additions and 0 deletions

69
draw.c
View File

@ -319,6 +319,72 @@ void drawBoxes(DrawingContext *ctx)
drawBoxStd(ctx, "cabc ab", 'B'); drawBoxStd(ctx, "cabc ab", 'B');
} }
void drawBoxes2(DrawingContext *ctx)
{
/*
cairo_set_source_rgb(ctx->cairo, 1, 0.5, 0);
drawBoxStd(ctx, "a", 'A');
drawBoxStd(ctx, "ca", 'A');
drawBoxStd(ctx, "aca", 'A');
drawBoxStd(ctx, "caca", 'A');
drawBoxStd(ctx, "acaca", 'A');
cairo_set_source_rgb(ctx->cairo, 0, 0.5, 1);
drawBoxStd(ctx, "acac", 'A');
drawBoxStd(ctx, "cac", 'A');
drawBoxStd(ctx, "ac", 'A');
drawBoxStd(ctx, "c", 'A');
drawBoxStd(ctx, "", 'A');
*/
/*
cairo_set_source_rgb(ctx->cairo, 0, 0.5, 1);
drawBox(ctx, "abc", "cab");
// drawBox(ctx, "ba abc ab", "ba cab ab");
drawBox(ctx, "baba abc abab", "baba cab abab");
drawBox(ctx, "abab abc baba", "abab cab baba");
drawBox(ctx, "ab abc ba", "ab cab ba");
cairo_set_source_rgb(ctx->cairo, 1, 0.5, 0);
drawBox(ctx, "b abc b", "b cab b");
drawBox(ctx, "bab abc bab", "bab cab bab");
drawBox(ctx, "babab abc babab", "babab cab babab");
drawBox(ctx, "aba abc aba", "aba cab aba");
// drawBox(ctx, "a abc a", "a cab a");
cairo_set_source_rgb(ctx->cairo, 0, 0.5, 1);
drawBox(ctx, "bca", "abc");
// drawBox(ctx, "cb bca bc", "cb abc bc");
drawBox(ctx, "cbcb bca bcbc", "cbcb abc bcbc");
drawBox(ctx, "bcbc bca cbcb", "bcbc abc cbcb");
drawBox(ctx, "bc bca cb", "bc abc cb");
cairo_set_source_rgb(ctx->cairo, 1, 0.5, 0);
drawBox(ctx, "c bca c", "c abc c");
drawBox(ctx, "cbc bca cbc", "cbc abc cbc");
drawBox(ctx, "cbcbc bca cbcbc", "cbcbc abc cbcbc");
drawBox(ctx, "bcb bca bcb", "bcb abc bcb");
// drawBox(ctx, "b bca b", "b abc b");
*/
cairo_set_source_rgb(ctx->cairo, 0, 0, 0);
drawBox(ctx, "abc", "cab");
cairo_set_source_rgb(ctx->cairo, 0, 0.5, 1);
// drawBox(ctx, "cab", "bca");
// drawBox(ctx, "ac cab ca", "ac bca ca");
// drawBox(ctx, "acac cab caca", "acac bca caca");
drawBox(ctx, "caca cab acac", "caca bca acac");
drawBox(ctx, "ca cab ac", "ca bca ac");
cairo_set_source_rgb(ctx->cairo, 1, 0.5, 0);
drawBox(ctx, "a cab a", "a bca a");
drawBox(ctx, "aca cab aca", "aca bca aca");
// drawBox(ctx, "acaca cab acaca", "acaca bca acaca");
// drawBox(ctx, "cac cab cac", "cac bca cac");
// drawBox(ctx, "c cab c", "c bca c");
}
void drawLimitCurve(DrawingContext *ctx) void drawLimitCurve(DrawingContext *ctx)
{ {
cairo_t *C = ctx->cairo; cairo_t *C = ctx->cairo;
@ -392,6 +458,9 @@ void draw(DrawingContext *ctx)
if(ctx->show_boxes) if(ctx->show_boxes)
drawBoxes(ctx); drawBoxes(ctx);
if(ctx->show_boxes2)
drawBoxes2(ctx);
if(ctx->show_attractors) if(ctx->show_attractors)
drawAttractors(ctx); drawAttractors(ctx);

6
main.c
View File

@ -26,6 +26,7 @@ void setupContext(DrawingContext *ctx)
ctx->k[2] = 2; ctx->k[2] = 2;
ctx->parameter = 3.0; ctx->parameter = 3.0;
ctx->show_boxes = 0; ctx->show_boxes = 0;
ctx->show_boxes2 = 0;
ctx->show_attractors = 0; ctx->show_attractors = 0;
ctx->show_reflectors = 0; ctx->show_reflectors = 0;
ctx->show_limit= 1; ctx->show_limit= 1;
@ -89,6 +90,8 @@ void print(DrawingContext *screen)
time_t t = time(NULL); time_t t = time(NULL);
strftime(filename, sizeof(filename), "screenshot_%Y%m%d_%H%M%S.pdf", localtime(&t)); strftime(filename, sizeof(filename), "screenshot_%Y%m%d_%H%M%S.pdf", localtime(&t));
memcpy(&file, screen, sizeof(file));
dim.width = screen->dim->width; dim.width = screen->dim->width;
dim.height = screen->dim->width / sqrt(2.0); dim.height = screen->dim->width / sqrt(2.0);
dim.matrix = screen->dim->matrix; dim.matrix = screen->dim->matrix;
@ -171,6 +174,9 @@ int processEvent(GraphicsInfo *info, XEvent *ev)
case 'b': case 'b':
TOGGLE(screen_context->show_boxes); TOGGLE(screen_context->show_boxes);
break; break;
case 'B':
TOGGLE(screen_context->show_boxes2);
break;
case 'a': case 'a':
TOGGLE(screen_context->show_attractors); TOGGLE(screen_context->show_attractors);
break; break;

2
main.h
View File

@ -32,6 +32,7 @@ typedef struct {
double parameter; double parameter;
int n_group_elements; int n_group_elements;
int show_boxes; int show_boxes;
int show_boxes2;
int show_attractors; int show_attractors;
int show_reflectors; int show_reflectors;
int show_limit; int show_limit;
@ -112,6 +113,7 @@ void drawBoxStd(DrawingContext *ctx, const char *word, char base);
void drawReflectors(DrawingContext *ctx); void drawReflectors(DrawingContext *ctx);
void drawAttractors(DrawingContext *ctx); void drawAttractors(DrawingContext *ctx);
void drawBoxes(DrawingContext *ctx); void drawBoxes(DrawingContext *ctx);
void drawBoxes2(DrawingContext *ctx);
void drawLimitCurve(DrawingContext *ctx); void drawLimitCurve(DrawingContext *ctx);
void drawText(DrawingContext *ctx); void drawText(DrawingContext *ctx);
void draw(DrawingContext *ctx); void draw(DrawingContext *ctx);