somewhat stable version of the limit set program
This commit is contained in:
parent
f257364907
commit
bc2fdcd132
31
draw.c
31
draw.c
@ -759,6 +759,7 @@ void drawBoxes2(DrawingContext *ctx)
|
|||||||
gsl_matrix *tmp = getTempMatrix(ctx->ws);
|
gsl_matrix *tmp = getTempMatrix(ctx->ws);
|
||||||
gsl_matrix **gen = getTempMatrices(ctx->ws, 3);
|
gsl_matrix **gen = getTempMatrices(ctx->ws, 3);
|
||||||
cairo_t *C = ctx->cairo;
|
cairo_t *C = ctx->cairo;
|
||||||
|
cairo_save(C);
|
||||||
initializeTriangleGenerators(gen, ctx->cartan);
|
initializeTriangleGenerators(gen, ctx->cartan);
|
||||||
|
|
||||||
// abc, ababcba, abababcbaba, ..., cab
|
// abc, ababcba, abababcbaba, ..., cab
|
||||||
@ -776,7 +777,7 @@ void drawBoxes2(DrawingContext *ctx)
|
|||||||
i[2] = cross(cross(v[2][0],v[2][2]),cross(v[3][0],v[3][2]));
|
i[2] = cross(cross(v[2][0],v[2][2]),cross(v[3][0],v[3][2]));
|
||||||
i[3] = cross(cross(v[0][0],v[0][2]),cross(v[1][0],v[1][2]));
|
i[3] = cross(cross(v[0][0],v[0][2]),cross(v[1][0],v[1][2]));
|
||||||
|
|
||||||
cairo_set_source_rgb(C, 0, 0, 1);
|
// cairo_set_source_rgb(C, 0, 0, 1);
|
||||||
// drawPolygon(ctx, 1, 6, v[2][2], v[1][1], v[0][1], v[3][2], v[3][1], v[2][1]);
|
// drawPolygon(ctx, 1, 6, v[2][2], v[1][1], v[0][1], v[3][2], v[3][1], v[2][1]);
|
||||||
// drawPolygon(ctx, 1, 6, v[1][2], i[1], i[2], i[0], v[0][2], i[3]);
|
// drawPolygon(ctx, 1, 6, v[1][2], i[1], i[2], i[0], v[0][2], i[3]);
|
||||||
|
|
||||||
@ -790,22 +791,30 @@ void drawBoxes2(DrawingContext *ctx)
|
|||||||
drawBox(ctx, "bcbcbcbc bca cbcbcbcb", "bcbcbcbc abc cbcbcbcb");
|
drawBox(ctx, "bcbcbcbc bca cbcbcbcb", "bcbcbcbc abc cbcbcbcb");
|
||||||
drawBox(ctx, "bcbcbcbcbc bca cbcbcbcbcb", "bcbcbcbcbc abc cbcbcbcbcb");
|
drawBox(ctx, "bcbcbcbcbc bca cbcbcbcbcb", "bcbcbcbcbc abc cbcbcbcbcb");
|
||||||
*/
|
*/
|
||||||
|
cairo_set_line_width(C, 1.5/ctx->dim->scalefactor);
|
||||||
cairo_set_source_rgb(C, 1, 0, 0);
|
cairo_set_source_rgb(C, 1, 0, 0);
|
||||||
drawBox(ctx, "bca", "abc");
|
drawBox(ctx, "bca", "abc");
|
||||||
|
|
||||||
cairo_set_source_rgb(C, 1, 0.5, 0);
|
cairo_set_source_rgb(C, 1, 0.5, 0);
|
||||||
drawBox(ctx, "ab abc ba", "ab cab ba");
|
drawBox(ctx, "ab abc ba", "ab cab ba");
|
||||||
drawBox(ctx, "abab abc baba", "abab cab baba");
|
drawBox(ctx, "abab abc baba", "abab cab baba");
|
||||||
drawBox(ctx, "ababab abc bababa", "ababab cab bababa");
|
drawBox(ctx, "ababab abc bababa", "ababab cab bababa");
|
||||||
drawBox(ctx, "abababab abc babababa", "abababab cab babababa");
|
drawBox(ctx, "abababab abc babababa", "abababab cab babababa");
|
||||||
drawBox(ctx, "ababababab abc bababababa", "ababababab cab bababababa");
|
// drawBox(ctx, "ababababab abc bababababa", "ababababab cab bababababa");
|
||||||
|
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, "bababab abc bababab", "bababab cab bababab");
|
||||||
|
// drawBox(ctx, "babababab abc babababab", "babababab cab babababab");
|
||||||
|
|
||||||
|
/*
|
||||||
cairo_set_source_rgb(C, 1, 0, 0);
|
cairo_set_source_rgb(C, 1, 0, 0);
|
||||||
drawBox(ctx, "ab ca cab ac ba", "ab ca bca ac ba");
|
drawBox(ctx, "ab ca cab ac ba", "ab ca bca ac ba");
|
||||||
drawBox(ctx, "ab caca cab acac ba", "ab caca bca acac ba");
|
drawBox(ctx, "ab caca cab acac ba", "ab caca bca acac ba");
|
||||||
drawBox(ctx, "ab cacaca cab acacac ba", "ab cacaca bca acacac ba");
|
drawBox(ctx, "ab cacaca cab acacac ba", "ab cacaca bca acacac ba");
|
||||||
drawBox(ctx, "ab cacacaca cab acacacac ba", "ab cacacaca bca acacacac ba");
|
drawBox(ctx, "ab cacacaca cab acacacac ba", "ab cacacaca bca acacacac ba");
|
||||||
drawBox(ctx, "ab cacacacaca cab acacacacac ba", "ab cacacacaca bca acacacacac ba");
|
drawBox(ctx, "ab cacacacaca cab acacacacac ba", "ab cacacacaca bca acacacacac ba");
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
drawBox(ctx, "ab abc ba", "ab cab ba");
|
drawBox(ctx, "ab abc ba", "ab cab ba");
|
||||||
drawBox(ctx, "abab abc baba", "abab cab baba");
|
drawBox(ctx, "abab abc baba", "abab cab baba");
|
||||||
@ -842,6 +851,7 @@ void drawBoxes2(DrawingContext *ctx)
|
|||||||
// drawBox(ctx, "cab", "bca");
|
// drawBox(ctx, "cab", "bca");
|
||||||
// drawBox(ctx, "ca cab ac", "ca bca ac");
|
// drawBox(ctx, "ca cab ac", "ca bca ac");
|
||||||
|
|
||||||
|
cairo_restore(C);
|
||||||
releaseTempMatrices(ctx->ws, 4);
|
releaseTempMatrices(ctx->ws, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -888,10 +898,10 @@ void drawDualLimitCurve(DrawingContext *ctx)
|
|||||||
cairo_set_source_rgb(C, 0, 0, 0);
|
cairo_set_source_rgb(C, 0, 0, 0);
|
||||||
|
|
||||||
int n = 18;
|
int n = 18;
|
||||||
vector_t p[18][3];
|
vector_t p[n][3];
|
||||||
vector_t l[n][3];
|
vector_t l[n][3];
|
||||||
|
|
||||||
/*
|
|
||||||
fixedPoints(ctx, "abc", p[0]);
|
fixedPoints(ctx, "abc", p[0]);
|
||||||
fixedPoints(ctx, "ab abc ba", p[1]);
|
fixedPoints(ctx, "ab abc ba", p[1]);
|
||||||
fixedPoints(ctx, "abab abc baba", p[2]);
|
fixedPoints(ctx, "abab abc baba", p[2]);
|
||||||
@ -911,8 +921,9 @@ void drawDualLimitCurve(DrawingContext *ctx)
|
|||||||
fixedPoints(ctx, "bababa bca ababab", p[15]);
|
fixedPoints(ctx, "bababa bca ababab", p[15]);
|
||||||
fixedPoints(ctx, "baba bca abab", p[16]);
|
fixedPoints(ctx, "baba bca abab", p[16]);
|
||||||
fixedPoints(ctx, "ba bca ab", p[17]);
|
fixedPoints(ctx, "ba bca ab", p[17]);
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
fixedPoints(ctx, "abc", p[0]);
|
fixedPoints(ctx, "abc", p[0]);
|
||||||
fixedPoints(ctx, "ac abc ca", p[1]);
|
fixedPoints(ctx, "ac abc ca", p[1]);
|
||||||
fixedPoints(ctx, "acac abc caca", p[2]);
|
fixedPoints(ctx, "acac abc caca", p[2]);
|
||||||
@ -932,7 +943,7 @@ void drawDualLimitCurve(DrawingContext *ctx)
|
|||||||
fixedPoints(ctx, "cacaca bca acacac", p[15]);
|
fixedPoints(ctx, "cacaca bca acacac", p[15]);
|
||||||
fixedPoints(ctx, "caca bca acac", p[16]);
|
fixedPoints(ctx, "caca bca acac", p[16]);
|
||||||
fixedPoints(ctx, "ca bca ac", p[17]);
|
fixedPoints(ctx, "ca bca ac", p[17]);
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
fixedPoints(ctx, "cab", p[2]);
|
fixedPoints(ctx, "cab", p[2]);
|
||||||
@ -943,7 +954,7 @@ void drawDualLimitCurve(DrawingContext *ctx)
|
|||||||
|
|
||||||
for(int i = 0; i < n; i++) {
|
for(int i = 0; i < n; i++) {
|
||||||
LOOP(j) l[i][j] = cross(p[i][(3-j)%3], p[i][(4-j)%3]);
|
LOOP(j) l[i][j] = cross(p[i][(3-j)%3], p[i][(4-j)%3]);
|
||||||
// drawCovector(ctx, l[i][0]);
|
drawCovector(ctx, l[i][0]);
|
||||||
drawCovector(ctx, l[i][2]);
|
drawCovector(ctx, l[i][2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -956,7 +967,7 @@ void drawLimitCurve(DrawingContext *ctx)
|
|||||||
|
|
||||||
cairo_save(C);
|
cairo_save(C);
|
||||||
|
|
||||||
cairo_set_source_rgb(C, 0.5, 0.5, 0.5);
|
cairo_set_source_rgb(C, 0.0, 0.0, 0.0);
|
||||||
|
|
||||||
if(ctx->limit_with_lines) {
|
if(ctx->limit_with_lines) {
|
||||||
int previous_inside = 0;
|
int previous_inside = 0;
|
||||||
@ -984,7 +995,7 @@ void drawLimitCurve(DrawingContext *ctx)
|
|||||||
p.y = ctx->limit_curve[3*i+1];
|
p.y = ctx->limit_curve[3*i+1];
|
||||||
|
|
||||||
if(isInsideBB(ctx, p)) {
|
if(isInsideBB(ctx, p)) {
|
||||||
cairo_arc(C, p.x, p.y, 2.0/ctx->dim->scalefactor, 0, 2*M_PI);
|
cairo_arc(C, p.x, p.y, 0.5/ctx->dim->scalefactor, 0, 2*M_PI);
|
||||||
cairo_close_path(C);
|
cairo_close_path(C);
|
||||||
cairo_fill(C);
|
cairo_fill(C);
|
||||||
}
|
}
|
||||||
|
75
main.c
75
main.c
@ -138,6 +138,31 @@ void updateMatrices(DrawingContext *ctx)
|
|||||||
|
|
||||||
if(ctx->use_rotation_basis % 4 == 0) {
|
if(ctx->use_rotation_basis % 4 == 0) {
|
||||||
gsl_matrix_memcpy(ctx->cob, ctx->cartan); // is this a good choice of basis for any reason?
|
gsl_matrix_memcpy(ctx->cob, ctx->cartan); // is this a good choice of basis for any reason?
|
||||||
|
|
||||||
|
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, 1.0);
|
||||||
|
gsl_matrix_set(tmp, 2, 0, 0.0);
|
||||||
|
gsl_matrix_set(tmp, 2, 1, -1.0);
|
||||||
|
gsl_matrix_set(tmp, 2, 2, 1.0);
|
||||||
|
multiply_left(tmp, ctx->cob, ctx->ws);
|
||||||
|
|
||||||
|
/*
|
||||||
|
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);
|
||||||
|
gsl_matrix_set(tmp, 1, 0, 1.0);
|
||||||
|
gsl_matrix_set(tmp, 1, 1, -0.5);
|
||||||
|
gsl_matrix_set(tmp, 1, 2, -0.5);
|
||||||
|
gsl_matrix_set(tmp, 2, 0, 1.0);
|
||||||
|
gsl_matrix_set(tmp, 2, 1, 1.0);
|
||||||
|
gsl_matrix_set(tmp, 2, 2, 1.0);
|
||||||
|
gsl_matrix_memcpy(ctx->cob, tmp);
|
||||||
|
*/
|
||||||
|
|
||||||
// gsl_matrix_set_identity(ctx->cob); // is this a good choice of basis for any reason?
|
// gsl_matrix_set_identity(ctx->cob); // is this a good choice of basis for any reason?
|
||||||
} else if(ctx->use_rotation_basis % 4 == 1) {
|
} else if(ctx->use_rotation_basis % 4 == 1) {
|
||||||
computeRotationMatrix(ctx, tmp, "ba");
|
computeRotationMatrix(ctx, tmp, "ba");
|
||||||
@ -278,19 +303,43 @@ int processEvent(GraphicsInfo *info, XEvent *ev)
|
|||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
print(screen_context);
|
print(screen_context);
|
||||||
|
break;
|
||||||
|
case 'M':
|
||||||
/*
|
/*
|
||||||
screen_context->limit_with_lines = 0;
|
screen_context->limit_with_lines = 0;
|
||||||
for(int i = 0; i <= 800; i++) {
|
double parameter_start = screen_context->parameter;
|
||||||
screen_context->parameter = exp(0.005*i-2);
|
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));
|
||||||
updateMatrices(screen_context);
|
updateMatrices(screen_context);
|
||||||
computeLimitCurve(screen_context);
|
computeLimitCurve(screen_context);
|
||||||
draw(screen_context);
|
draw(screen_context);
|
||||||
sprintf(filename, "test%03d.png", i);
|
sprintf(filename, "movie3/test%03d.png", i);
|
||||||
cairo_surface_write_to_png(info->buffer_surface, filename);
|
cairo_surface_write_to_png(info->buffer_surface, filename);
|
||||||
printf("Finished drawing %s\n", filename);
|
printf("Finished drawing %s\n", filename);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
break;
|
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);
|
||||||
|
cairo_surface_write_to_png(info->buffer_surface, filename);
|
||||||
|
printf("Finished drawing %s\n", filename);
|
||||||
|
}
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
TOGGLE(screen_context->use_repelling);
|
TOGGLE(screen_context->use_repelling);
|
||||||
computeLimitCurve(screen_context);
|
computeLimitCurve(screen_context);
|
||||||
@ -319,21 +368,21 @@ int main()
|
|||||||
if(!info)
|
if(!info)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
info->dim->matrix.xx = 112.465171;
|
|
||||||
info->dim->matrix.xy = 0.000000;
|
|
||||||
info->dim->matrix.x0 = 891.180490;
|
|
||||||
info->dim->matrix.yx = 0.000000;
|
|
||||||
info->dim->matrix.yy = 112.465171;
|
|
||||||
info->dim->matrix.y0 = 506.676280;
|
|
||||||
*/
|
|
||||||
|
|
||||||
info->dim->matrix.xx = 274.573171;
|
info->dim->matrix.xx = 274.573171;
|
||||||
info->dim->matrix.xy = 0.000000;
|
info->dim->matrix.xy = 0.000000;
|
||||||
info->dim->matrix.x0 = 583.073462;
|
info->dim->matrix.x0 = 583.073462;
|
||||||
info->dim->matrix.yx = 0.000000;
|
info->dim->matrix.yx = 0.000000;
|
||||||
info->dim->matrix.yy = 274.573171;
|
info->dim->matrix.yy = 274.573171;
|
||||||
info->dim->matrix.y0 = 777.225293;
|
info->dim->matrix.y0 = 777.225293;
|
||||||
|
*/
|
||||||
|
|
||||||
|
info->dim->matrix.xx = 274.573171;
|
||||||
|
info->dim->matrix.xy = 0.000000;
|
||||||
|
info->dim->matrix.x0 = 910.073462;
|
||||||
|
info->dim->matrix.yx = 0.000000;
|
||||||
|
info->dim->matrix.yy = 274.573171;
|
||||||
|
info->dim->matrix.y0 = 509.225293;
|
||||||
|
|
||||||
updateDimensions(info->dim);
|
updateDimensions(info->dim);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user