Compare commits
3 Commits
5538cca954
...
f989bf9e47
Author | SHA1 | Date | |
---|---|---|---|
|
f989bf9e47 | ||
|
370777535f | ||
|
5083e5ebdf |
50
README.md
Normal file
50
README.md
Normal file
@ -0,0 +1,50 @@
|
||||
# triangle_group_limit_set - visualizer for triangle group limit sets in the projective plane
|
||||
|
||||
This program visualizes the fractal limit set of triangle groups in SL(3,R) in the projective plane.
|
||||
|
||||
## Installation & Prerequisites ##
|
||||
|
||||
This program is written C and exclusively for Linux. It uses [Cairo] for drawing and X11 for input, which means it will only run in the X window system. Besides these, the only required library is the [Gnu Scientific Library (GSL)] including CBLAS.
|
||||
|
||||
To build, make sure GCC as well as these libraries are installed, and run
|
||||
|
||||
make
|
||||
|
||||
Then we can run it for example like this:
|
||||
|
||||
./limit_set 5 5 5 1 1 1 1.0 1.0
|
||||
|
||||
The arguments are 6 integers (p1, p2, p3, q1, q2, q3) and two floating point numbers (t,s) describing the triangle group under consideration (initially, t and s can be changed with the arrow keys).
|
||||
The last argument is optional; if it is not given, it defaults to s = 1.
|
||||
|
||||
## Key bindings
|
||||
|
||||
Drag the mouse to move the image, drag with Shift pressed to rotate.
|
||||
|
||||
| Key | function |
|
||||
|----------|-----------------------------------------------------------------------------------------------------|
|
||||
| PageUp | increase t by 2% |
|
||||
| PageDown | decrease t by 2% |
|
||||
| Right | increase t by 0.2% |
|
||||
| Left | decreaes t by 0.2% |
|
||||
| Up | increase t by 0.002% |
|
||||
| Down | decrease t by 0.002% |
|
||||
| Space | (reset t to original value) |
|
||||
| R | cycle through affine charts |
|
||||
| l | show limit curve |
|
||||
| L | show limit curve as line or as points |
|
||||
| f | generate limit curve using attracting / repelling fixed points of conjugates of the Coxeter element |
|
||||
| d | show dual limit curve |
|
||||
| r | show fixed points and lines of generating reflections |
|
||||
| a | show fixed points and lines of Coxeter elements |
|
||||
| c | show the orbit of an arbitrary point (point can be changed with Shift+Click) |
|
||||
| b | show certain conics touching the limit curve |
|
||||
| B | show the "boxes" used to approximate the limit curve |
|
||||
| p | save a screenshot of the current image (in PDF format) |
|
||||
| t | toggle info text |
|
||||
| i | (print some info to terminal?) |
|
||||
| x | (show rotated reflectors?) |
|
||||
| M | (make a movie) |
|
||||
|
||||
[Cairo]: https://cairographics.org/
|
||||
[Gnu Scientific Library (GSL)]: https://www.gnu.org/software/gsl/
|
514
draw.c
514
draw.c
@ -96,20 +96,10 @@ void drawPoint(DrawingContext *ctx, point_t p)
|
||||
cairo_t *C = ctx->cairo;
|
||||
|
||||
cairo_save(C);
|
||||
cairo_arc(C, p.x, p.y, 3.0/ctx->dim->scalefactor, 0, 2*M_PI);
|
||||
cairo_arc(C, p.x, p.y, 4.0/ctx->dim->scalefactor, 0, 2*M_PI);
|
||||
cairo_close_path(C);
|
||||
cairo_fill(C);
|
||||
cairo_restore(C);
|
||||
|
||||
/*
|
||||
cairo_save(C);
|
||||
cairo_move_to(C, p.x, p.y);
|
||||
cairo_close_path(C);
|
||||
cairo_set_line_cap(C, CAIRO_LINE_CAP_ROUND);
|
||||
cairo_set_line_width(C, 10.0/ctx->dim->scalefactor);
|
||||
cairo_stroke(C);
|
||||
cairo_restore(C);
|
||||
*/
|
||||
}
|
||||
|
||||
void drawSegment2d(DrawingContext *ctx, point_t a, point_t b)
|
||||
@ -193,22 +183,13 @@ void drawSegmentWith(DrawingContext *ctx, vector_t a, vector_t b, vector_t line,
|
||||
LOOP(i) x[i] = 0.0;
|
||||
LOOP(i) LOOP(j) {
|
||||
cofactor = gsl_matrix_get(ctx->cob, (i+1)%3, (j+1)%3) * gsl_matrix_get(ctx->cob, (i+2)%3, (j+2)%3)
|
||||
- gsl_matrix_get(ctx->cob, (i+1)%3, (j+2)%3) * gsl_matrix_get(ctx->cob, (i+2)%3, (j+1)%3);
|
||||
- gsl_matrix_get(ctx->cob, (i+1)%3, (j+2)%3) * gsl_matrix_get(ctx->cob, (i+2)%3, (j+1)%3);
|
||||
x[i] += cofactor * line.x[j];
|
||||
}
|
||||
|
||||
// t = parameter on segment of intersection with line, s(t) = a + (b-a)*t
|
||||
tline = -(a_.x*x[0] + a_.y*x[1] + x[2])/((b_.x - a_.x)*x[0] + (b_.y - a_.y)*x[1]);
|
||||
|
||||
/*
|
||||
printf("tline: %f\n", tline);
|
||||
|
||||
point_t s;
|
||||
s.x = a_.x - (b_.x-a_.x)*tline;
|
||||
s.y = a_.y - (b_.y-a_.y)*tline;
|
||||
drawPoint(ctx, s);
|
||||
*/
|
||||
|
||||
if((tline < 0 || tline > 1) != contains) {
|
||||
drawSegment2d(ctx, a_, b_);
|
||||
} else { // need to draw complementary segment
|
||||
@ -216,6 +197,7 @@ void drawSegmentWith(DrawingContext *ctx, vector_t a, vector_t b, vector_t line,
|
||||
m.x = ctx->dim->center_x;
|
||||
m.y = ctx->dim->center_y;
|
||||
r = ctx->dim->radius;
|
||||
|
||||
// equation is coeff2 t^2 + 2 coeff1 t + coeff0 = 0
|
||||
coeff0 = (a_.x - m.x)*(a_.x - m.x) + (a_.y - m.y)*(a_.y - m.y) - r*r;
|
||||
coeff1 = (a_.x - m.x)*(b_.x - a_.x) + (a_.y - m.y)*(b_.y - a_.y);
|
||||
@ -236,7 +218,6 @@ void drawSegmentWith(DrawingContext *ctx, vector_t a, vector_t b, vector_t line,
|
||||
}
|
||||
|
||||
// level 3: boxes and polygons
|
||||
|
||||
void drawPolygon(DrawingContext *ctx, int segments, int sides, ...)
|
||||
{
|
||||
va_list args;
|
||||
@ -298,8 +279,6 @@ void drawBoxLines(DrawingContext *ctx, const char *word1, const char *word2)
|
||||
drawPolygon(ctx, 0, 4, p[0][0], i[0], p[1][0], i[1]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void drawBoxStd(DrawingContext *ctx, const char *word, char base)
|
||||
{
|
||||
char word1[100];
|
||||
@ -579,7 +558,8 @@ void drawAttractors(DrawingContext *ctx)
|
||||
fixedPoints(ctx, "abc", p[0]);
|
||||
fixedPoints(ctx, "bca", p[1]);
|
||||
fixedPoints(ctx, "cab", p[2]);
|
||||
fixedPoints(ctx, "a cab a", p[3]);
|
||||
// fixedPoints(ctx, "abacacbabc", p[3]);
|
||||
// fixedPoints(ctx, "abcabcabcabcab", p[3]);
|
||||
fixedPoints(ctx, "b abc b", p[4]);
|
||||
fixedPoints(ctx, "c bca c", p[5]);
|
||||
|
||||
@ -653,12 +633,6 @@ void drawCurvedBox(DrawingContext *ctx, int base, const char *conj, int style)
|
||||
fixedPoints(ctx, word, p[10]);
|
||||
|
||||
|
||||
// conjugate_word("bca b abc b acb", modifier, conj, word);
|
||||
// fixedPoints(ctx, word, p[6]);
|
||||
// conjugate_word("bca baca cab acab acb", modifier, conj, word);
|
||||
// fixedPoints(ctx, word, p[7]);
|
||||
|
||||
|
||||
LOOP(j) l[0][j] = cross(p[0][(3-j)%3], p[0][(4-j)%3]);
|
||||
LOOP(j) l[1][j] = cross(p[1][(3-j)%3], p[1][(4-j)%3]);
|
||||
LOOP(j) l[10][j] = cross(p[10][(3-j)%3], p[10][(4-j)%3]);
|
||||
@ -734,153 +708,15 @@ void drawBoxes(DrawingContext *ctx)
|
||||
drawRotationOrbit(ctx, "ca", p[0][0]);
|
||||
|
||||
if(ctx->mode >= 2) {
|
||||
cairo_set_source_rgb(C, 0.6, 0.6, 1);
|
||||
drawRotationOrbit(ctx, "bcabcb", p[1][0]); // bcC
|
||||
drawRotationOrbit(ctx, "abcabcba", p[0][0]); // abcC
|
||||
// drawRotationOrbit(ctx, "bcabcabacb", p[1][0]); // bcabC''
|
||||
// drawRotationOrbit(ctx, "bacabcacab", p[3][0]); // bacaC'
|
||||
// drawRotationOrbit(ctx, "bcacabcacacb", p[4][0]); // bcacaC' bcacabacb
|
||||
}
|
||||
|
||||
cairo_set_source_rgb(C, 1, 0, 1);
|
||||
// drawRotationOrbit(ctx, "bacabcacab", p[3][0]); // ababcba
|
||||
cairo_set_source_rgb(C, 0, 0, 0);
|
||||
fixedPoints(ctx, "abababcbaba", p[3]);
|
||||
// drawRotationOrbit(ctx, "abababcabcbababa", p[3][0]); // bab abc bab
|
||||
|
||||
cairo_set_source_rgb(C, 0, 0, 1);
|
||||
// fixedPoints(ctx, "cab", p[3]);
|
||||
// drawRotationOrbit(ctx, "cabc", p[3][0]);
|
||||
// fixedPoints(ctx, "bca", p[3]);
|
||||
// drawRotationOrbit(ctx, "bcabcb", p[3][0]);
|
||||
// fixedPoints(ctx, "bc abc cb", p[3]);
|
||||
// drawRotationOrbit(ctx, "bcabcb", p[3][0]);
|
||||
|
||||
fixedPoints(ctx, "bc bca cb", p[3]);
|
||||
// drawRotationOrbit(ctx, "bcbcacbc", p[3][0]);
|
||||
|
||||
/*
|
||||
cairo_set_source_rgb(C, 0, 0, 0);
|
||||
strncpy(word,"abc",100);
|
||||
for(int i = 0; i < 9; i++) {
|
||||
conjugate_word(word, 0, "ab", word2);
|
||||
strncpy(word, word2, 100);
|
||||
fixedPoints(ctx, word, ptmp);
|
||||
drawVector(ctx, ptmp[0]);
|
||||
// drawVector(ctx, ptmp[2]);
|
||||
}
|
||||
|
||||
strncpy(word,"bca",100);
|
||||
for(int i = 0; i < 9; i++) {
|
||||
conjugate_word(word, 0, "ab", word2);
|
||||
strncpy(word, word2, 100);
|
||||
fixedPoints(ctx, word, ptmp);
|
||||
drawVector(ctx, ptmp[0]);
|
||||
// drawVector(ctx, ptmp[2]);
|
||||
}
|
||||
|
||||
|
||||
strncpy(word,"abc",100);
|
||||
for(int i = 0; i < 9; i++) {
|
||||
conjugate_word(word, 0, "bc", word2);
|
||||
strncpy(word, word2, 100);
|
||||
fixedPoints(ctx, word, ptmp);
|
||||
drawVector(ctx, ptmp[0]);
|
||||
}
|
||||
|
||||
strncpy(word,"cab",100);
|
||||
for(int i = 0; i < 9; i++) {
|
||||
conjugate_word(word, 0, "bc", word2);
|
||||
strncpy(word, word2, 100);
|
||||
fixedPoints(ctx, word, ptmp);
|
||||
drawVector(ctx, ptmp[0]);
|
||||
}
|
||||
|
||||
strncpy(word,"cab",100);
|
||||
for(int i = 0; i < 9; i++) {
|
||||
conjugate_word(word, 0, "ca", word2);
|
||||
strncpy(word, word2, 100);
|
||||
fixedPoints(ctx, word, ptmp);
|
||||
drawVector(ctx, ptmp[0]);
|
||||
}
|
||||
|
||||
strncpy(word,"abc",100);
|
||||
for(int i = 0; i < 9; i++) {
|
||||
conjugate_word(word, 0, "ca", word2);
|
||||
strncpy(word, word2, 100);
|
||||
fixedPoints(ctx, word, ptmp);
|
||||
drawVector(ctx, ptmp[0]);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
cairo_set_source_rgb(C, 1, 0, 0);
|
||||
drawVector(ctx, p[0][0]);
|
||||
cairo_set_source_rgb(C, 0, 0.6, 0);
|
||||
drawVector(ctx, p[1][0]);
|
||||
cairo_set_source_rgb(C, 0, 0, 1);
|
||||
drawVector(ctx, p[2][0]);
|
||||
*/
|
||||
|
||||
/*
|
||||
fixedPoints(ctx, "ab abc ba", p[4]);
|
||||
fixedPoints(ctx, "abab abc baba", p[5]);
|
||||
fixedPoints(ctx, "ababab abc bababa", p[6]);
|
||||
fixedPoints(ctx, "abababab abc babababa", p[7]);
|
||||
fixedPoints(ctx, "babababa abc abababab", p[8]);
|
||||
fixedPoints(ctx, "bababa abc ababab", p[9]);
|
||||
fixedPoints(ctx, "baba abc abab", p[10]);
|
||||
fixedPoints(ctx, "ba abc ab", p[11]);
|
||||
fixedPoints(ctx, "bca", p[12]);
|
||||
fixedPoints(ctx, "b abc b", p[13]);
|
||||
fixedPoints(ctx, "bab abc bab", p[14]);
|
||||
fixedPoints(ctx, "babab abc babab", p[15]);
|
||||
fixedPoints(ctx, "bababab abc bababab", p[16]);
|
||||
fixedPoints(ctx, "abababab bca babababa", p[17]);
|
||||
fixedPoints(ctx, "ababab bca bababa", p[18]);
|
||||
fixedPoints(ctx, "abab bca baba", p[19]);
|
||||
fixedPoints(ctx, "ab bca ba", p[20]);
|
||||
*/
|
||||
|
||||
// initializeTriangleGenerators(gen, ctx->cartan);
|
||||
|
||||
// for(int i = 0; i < 22; i++) LOOP(j) l[i][j] = cross(p[i][(3-j)%3], p[i][(4-j)%3]);
|
||||
// LOOP(i) LOOP(j) alpha[i].x[j] = gsl_matrix_get(ctx->cartan, i, j);
|
||||
|
||||
/*
|
||||
gsl_matrix_set(frame, 0, 0, 2.0);
|
||||
gsl_matrix_set(frame, 0, 1, 0.0);
|
||||
gsl_matrix_set(frame, 0, 2, 1.0);
|
||||
gsl_matrix_set(frame, 1, 0, -1.0);
|
||||
gsl_matrix_set(frame, 1, 1, sqrt(3));
|
||||
gsl_matrix_set(frame, 1, 2, 1.0);
|
||||
gsl_matrix_set(frame, 2, 0, -1.0);
|
||||
gsl_matrix_set(frame, 2, 1, -sqrt(3));
|
||||
gsl_matrix_set(frame, 2, 2, 1.0);*/
|
||||
// drawRotationOrbitFrame(ctx, frame, p[0][0]);
|
||||
|
||||
// drawRotationOrbit(ctx, "bc", p[0][0]);
|
||||
|
||||
// drawRotationOrbit(ctx, "ca", p[0][0]);
|
||||
|
||||
/*
|
||||
for(int i = 0; i < 18; i++) {
|
||||
if(i == 0)
|
||||
cairo_set_source_rgb(C, 1, 0, 0);
|
||||
else if(i == 8)
|
||||
cairo_set_source_rgb(C, 0, 0, 1);
|
||||
else if(i == 9)
|
||||
cairo_set_source_rgb(C, 0, 0.6, 0);
|
||||
else
|
||||
cairo_set_source_rgb(C, 0, 0, 0);
|
||||
drawVector(ctx, p[3+i][0]);
|
||||
// drawCovector(ctx, l[3+i][0]);
|
||||
}
|
||||
*/
|
||||
|
||||
// drawRotationOrbit(ctx, "ab", cross(l[0][0], l[2][1]));
|
||||
|
||||
// drawRotationOrbit(ctx, "abca", p[0][0]);
|
||||
|
||||
cairo_restore(C);
|
||||
releaseTempMatrices(ctx->ws, 5);
|
||||
@ -902,56 +738,9 @@ void drawBoxes2(DrawingContext *ctx)
|
||||
|
||||
cairo_set_line_width(C, 2.5/ctx->dim->scalefactor);
|
||||
|
||||
/*
|
||||
cairo_set_source_rgb(C, 0, 1, 1);
|
||||
fixedPoints(ctx, "abc", p[0]);
|
||||
drawRotationOrbit(ctx, "bc", p[0][0]); // (r^{-1}a)^2 C / cbr
|
||||
fixedPoints(ctx, "bca", p[0]);
|
||||
drawRotationOrbit(ctx, "abca", p[0][0]); // (r^{-1}a)^2 C / cbr
|
||||
|
||||
cairo_set_source_rgb(C, 1, 1, 0);
|
||||
fixedPoints(ctx, "abc", p[0]);
|
||||
drawRotationOrbit(ctx, "cbcabc", p[0][0]); // (r^{-1}a)^4 C / cbac r-
|
||||
fixedPoints(ctx, "bca", p[0]);
|
||||
drawRotationOrbit(ctx, "acbcabca", p[0][0]); // (r^{-1}a)^4 C / cbac r-
|
||||
|
||||
cairo_set_source_rgb(C, 1, 0, 1);
|
||||
fixedPoints(ctx, "abc", p[0]);
|
||||
drawRotationOrbit(ctx, "cbacabcabc", p[0][0]); // (r^{-1}a)^6 C / cbacba
|
||||
fixedPoints(ctx, "bca", p[0]);
|
||||
drawRotationOrbit(ctx, "acbacabcabca", p[0][0]); // (r^{-1}a)^6 C / cbacba
|
||||
*/
|
||||
|
||||
/*
|
||||
cairo_set_source_rgb(C, 1, 0, 0);
|
||||
fixedPoints(ctx, "bca", p[3]);
|
||||
drawRotationOrbit(ctx, "bcabcb", p[3][0]); // cb c a bc
|
||||
fixedPoints(ctx, "abc", p[3]);
|
||||
drawRotationOrbit(ctx, "abcabcba", p[3][0]); // cb c a bc
|
||||
|
||||
cairo_set_source_rgb(C, 0, 1, 0);
|
||||
fixedPoints(ctx, "ababcba", p[3]);
|
||||
drawRotationOrbit(ctx, "ababcababa", p[3][0]); // cb c a bc
|
||||
fixedPoints(ctx, "abc", p[3]);
|
||||
drawRotationOrbit(ctx, "abcabcabacba", p[3][0]); // cb c a bc
|
||||
*/
|
||||
|
||||
// drawRotationOrbit(ctx, "bc", p[3][0]);
|
||||
|
||||
cairo_set_source_rgb(C, 0, 0, 0);
|
||||
drawCurvedBox(ctx, 'A', "", 2);
|
||||
|
||||
cairo_set_source_rgb(C, 0, 0, 1);
|
||||
// drawCurvedBox(ctx, 'C', "ab", 2);
|
||||
|
||||
// drawCurvedBox(ctx, 'C', "ab", 2);
|
||||
// drawCurvedBox(ctx, 'B', "bca", 2);
|
||||
// drawCurvedBox(ctx, 'B', "ba", 2);
|
||||
// drawCurvedBox(ctx, 'B', "bca", 2);
|
||||
// drawCurvedBox(ctx, 'B', "abca", 2);
|
||||
// drawCurvedBox(ctx, 'C', "abab", 2);
|
||||
// drawCurvedBox(ctx, 'C', "ababab", 2);
|
||||
|
||||
if(ctx->mode >= 3 && ctx->mode != 4) {
|
||||
cairo_set_source_rgb(C, 0, 0, 0);
|
||||
drawCurvedBox(ctx, 'B', "", 2);
|
||||
@ -967,15 +756,11 @@ void drawBoxes2(DrawingContext *ctx)
|
||||
drawCurvedBox(ctx, 'A', "bcbcbcbc", 2);
|
||||
drawCurvedBox(ctx, 'A', "bcbcbcbcbc", 2);
|
||||
drawCurvedBox(ctx, 'A', "bcbcbcbcbcbc", 2);
|
||||
// drawCurvedBox(ctx, 'A', "b", 2);
|
||||
// drawCurvedBox(ctx, 'A', "bcb", 2);
|
||||
// drawCurvedBox(ctx, 'A', "bcbcb", 2);
|
||||
// drawCurvedBox(ctx, 'A', "bcbcbcb", 2);
|
||||
// drawCurvedBox(ctx, 'A', "bcbcbcbcb", 2);
|
||||
}
|
||||
|
||||
if(ctx->mode == 6) {
|
||||
cairo_set_source_rgb(C, 0, 0.8, 0.5);
|
||||
drawCurvedBox(ctx, 'C', "ababab", 2);
|
||||
drawCurvedBox(ctx, 'C', "abababab", 2);
|
||||
drawCurvedBox(ctx, 'C', "ababababab", 2);
|
||||
}
|
||||
@ -984,285 +769,39 @@ void drawBoxes2(DrawingContext *ctx)
|
||||
cairo_set_source_rgb(C, 0, 0.8, 0.5);
|
||||
drawCurvedBox(ctx, 'C', "ab", 2);
|
||||
drawCurvedBox(ctx, 'C', "abab", 2);
|
||||
drawCurvedBox(ctx, 'C', "ababab", 2);
|
||||
}
|
||||
|
||||
if(ctx->mode >= 8) {
|
||||
cairo_set_source_rgb(C, 0, 0.8, 0.5);
|
||||
drawCurvedBox(ctx, 'C', "b", 2);
|
||||
drawCurvedBox(ctx, 'C', "bab", 2);
|
||||
drawCurvedBox(ctx, 'C', "babab", 2);
|
||||
}
|
||||
|
||||
if(ctx->mode >= 9) {
|
||||
cairo_set_source_rgb(C, 0.8, 0, 0.5);
|
||||
drawCurvedBox(ctx, 'B', "abca", 2);
|
||||
drawCurvedBox(ctx, 'B', "abcaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "abcacaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "aba", 2);
|
||||
drawCurvedBox(ctx, 'B', "abaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "abacaca", 2);
|
||||
cairo_set_source_rgb(C, 0.8, 0, 0.5);
|
||||
drawCurvedBox(ctx, 'B', "abca", 2);
|
||||
drawCurvedBox(ctx, 'B', "abcaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "aba", 2);
|
||||
drawCurvedBox(ctx, 'B', "abaca", 2);
|
||||
|
||||
drawCurvedBox(ctx, 'B', "ababca", 2);
|
||||
drawCurvedBox(ctx, 'B', "ababcaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "ababcacaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "ababa", 2);
|
||||
drawCurvedBox(ctx, 'B', "ababaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "ababacaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "ababca", 2);
|
||||
drawCurvedBox(ctx, 'B', "ababcaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "ababa", 2);
|
||||
drawCurvedBox(ctx, 'B', "ababaca", 2);
|
||||
|
||||
drawCurvedBox(ctx, 'B', "abababca", 2);
|
||||
drawCurvedBox(ctx, 'B', "abababcaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "abababcacaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "abababa", 2);
|
||||
drawCurvedBox(ctx, 'B', "abababaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "abababacaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "bca", 2);
|
||||
drawCurvedBox(ctx, 'B', "bcaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "ba", 2);
|
||||
drawCurvedBox(ctx, 'B', "baca", 2);
|
||||
|
||||
drawCurvedBox(ctx, 'B', "bca", 2);
|
||||
drawCurvedBox(ctx, 'B', "bcaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "bcacaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "ba", 2);
|
||||
drawCurvedBox(ctx, 'B', "baca", 2);
|
||||
drawCurvedBox(ctx, 'B', "bacaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "babca", 2);
|
||||
drawCurvedBox(ctx, 'B', "babcaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "baba", 2);
|
||||
drawCurvedBox(ctx, 'B', "babaca", 2);
|
||||
|
||||
drawCurvedBox(ctx, 'B', "babca", 2);
|
||||
drawCurvedBox(ctx, 'B', "babcaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "babcacaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "baba", 2);
|
||||
drawCurvedBox(ctx, 'B', "babaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "babacaca", 2);
|
||||
|
||||
drawCurvedBox(ctx, 'B', "bababca", 2);
|
||||
drawCurvedBox(ctx, 'B', "bababcaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "bababcacaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "bababa", 2);
|
||||
drawCurvedBox(ctx, 'B', "bababaca", 2);
|
||||
drawCurvedBox(ctx, 'B', "bababacaca", 2);
|
||||
cairo_restore(C);
|
||||
releaseTempMatrices(ctx->ws, 4);
|
||||
}
|
||||
|
||||
// drawCurvedBox(ctx, 'B', "abab", 2);
|
||||
// drawCurvedBox(ctx, 'B', "ababab", 2);
|
||||
|
||||
|
||||
|
||||
// drawCurvedBox(ctx, 'C', "b", 1);
|
||||
|
||||
// drawCurvedBox(ctx, 'C', "ababab");
|
||||
// drawCurvedBox(ctx, 'C', "abababab");
|
||||
// drawCurvedBox(ctx, 'C', "b");
|
||||
// drawCurvedBox(ctx, 'C', "bab");
|
||||
// drawCurvedBox(ctx, 'C', "babab");
|
||||
|
||||
// drawCurvedBox(ctx, 'C', "abababab");
|
||||
// drawCurvedBox(ctx, 'C', "ababababab");
|
||||
// drawCurvedBox(ctx, 'C', "abababababab");
|
||||
|
||||
|
||||
cairo_set_source_rgb(C, 0, 0, 1);
|
||||
// drawCurvedBox(ctx, 'B', "abca", 1);
|
||||
// drawCurvedBox(ctx, 'B', "aba", 1);
|
||||
// drawCurvedBox(ctx, 'B', "bca", 1);
|
||||
// drawCurvedBox(ctx, 'B', "ba", 1);
|
||||
// drawCurvedBox(ctx, 'B', "abaca");
|
||||
// drawCurvedBox(ctx, 'B', "abcaca");
|
||||
// drawCurvedBox(ctx, 'B', "abaca");
|
||||
// drawCurvedBox(ctx, 'B', "aba");
|
||||
// drawCurvedBox(ctx, 'B', "ababca");
|
||||
// drawCurvedBox(ctx, 'B', "ababa");
|
||||
// drawCurvedBox(ctx, 'B', "abababca");
|
||||
// drawCurvedBox(ctx, 'B', "abababa");
|
||||
// drawCurvedBox(ctx, 'B', "bca");
|
||||
// drawCurvedBox(ctx, 'B', "ba");
|
||||
// drawCurvedBox(ctx, 'B', "babca");
|
||||
// drawCurvedBox(ctx, 'B', "baba");
|
||||
// drawCurvedBox(ctx, 'B', "bababca");
|
||||
// drawCurvedBox(ctx, 'B', "bababa");
|
||||
|
||||
cairo_set_source_rgb(C, 1, 0, 1);
|
||||
// drawCurvedBox(ctx, 'A', "abcac");
|
||||
// drawCurvedBox(ctx, 'A', "bcac");
|
||||
// drawCurvedBox(ctx, 'A', "abcacbc");
|
||||
// drawCurvedBox(ctx, 'A', "abcac");
|
||||
// drawCurvedBox(ctx, 'A', "abcacbc");
|
||||
|
||||
// drawCurvedBox(ctx, 'A', "ababc");
|
||||
// drawCurvedBox(ctx, 'A', "ababcbc");
|
||||
/* drawCurvedBox(ctx, 'A', "abcac");
|
||||
drawCurvedBox(ctx, 'A', "ababc");
|
||||
drawCurvedBox(ctx, 'A', "abac");
|
||||
|
||||
drawCurvedBox(ctx, 'A', "ababcabc");
|
||||
drawCurvedBox(ctx, 'A', "ababcac");
|
||||
drawCurvedBox(ctx, 'A', "abababc");
|
||||
drawCurvedBox(ctx, 'A', "ababac");
|
||||
|
||||
drawCurvedBox(ctx, 'A', "abababcabc");
|
||||
drawCurvedBox(ctx, 'A', "abababcac");
|
||||
drawCurvedBox(ctx, 'A', "ababababc");
|
||||
drawCurvedBox(ctx, 'A', "abababac");
|
||||
|
||||
drawCurvedBox(ctx, 'A', "bcabc");
|
||||
drawCurvedBox(ctx, 'A', "bcac");
|
||||
drawCurvedBox(ctx, 'A', "babc");
|
||||
drawCurvedBox(ctx, 'A', "bac");
|
||||
|
||||
drawCurvedBox(ctx, 'A', "babcabc");
|
||||
drawCurvedBox(ctx, 'A', "babcac");
|
||||
drawCurvedBox(ctx, 'A', "bababc");
|
||||
drawCurvedBox(ctx, 'A', "babac");
|
||||
|
||||
drawCurvedBox(ctx, 'A', "bababcabc");
|
||||
drawCurvedBox(ctx, 'A', "bababcac");
|
||||
drawCurvedBox(ctx, 'A', "babababc");
|
||||
drawCurvedBox(ctx, 'A', "bababac");
|
||||
*/
|
||||
|
||||
// drawCurvedBox(ctx, 'A', "ababc");
|
||||
|
||||
cairo_set_source_rgb(C, 1, 0.5, 0);
|
||||
// drawCurvedBox(ctx, 'C', "abcabcab");
|
||||
|
||||
|
||||
// drawCurvedBox(ctx, 'B', "bca");
|
||||
// drawCurvedBox(ctx, 'B', "abcacaca");
|
||||
// drawCurvedBox(ctx, 'B', "abaca");
|
||||
// drawCurvedBox(ctx, 'B', "aba");
|
||||
// drawCurvedBox(ctx, 'B', "aba");
|
||||
// drawCurvedBox(ctx, 'B', "abcaca");
|
||||
// drawCurvedBox(ctx, 'B', "aba");
|
||||
// drawCurvedBox(ctx, 'B', "abaca");
|
||||
|
||||
cairo_set_source_rgb(C, 0, 0, 1);
|
||||
// drawCurvedBox(ctx, 'A', "abcabc");
|
||||
// drawCurvedBox(ctx, 'A', "abcabcbc");
|
||||
// drawCurvedBox(ctx, 'A', "abcacbc");
|
||||
// drawCurvedBox(ctx, 'A', "abcac");
|
||||
|
||||
// drawCurvedBox(ctx, 'A', "bcabc");
|
||||
// drawCurvedBox(ctx, 'A', "bcabcbc");
|
||||
// drawCurvedBox(ctx, 'A', "bcacbc");
|
||||
// drawCurvedBox(ctx, 'A', "bcac");
|
||||
|
||||
// drawCurvedBox(ctx, 'A', "abcac");
|
||||
// drawCurvedBox(ctx, 'A', "abcac");
|
||||
// drawCurvedBox(ctx, 'A', "abcacbc");
|
||||
|
||||
// drawCurvedBox(ctx, 'B', "abacaca");
|
||||
// drawCurvedBox(ctx, 'B', "abacacaca");
|
||||
|
||||
|
||||
cairo_set_source_rgb(C, 0, 1, 1);
|
||||
fixedPoints(ctx, "ababcba", p[0]);
|
||||
// drawRotationOrbit(ctx, "abcaba", p[0][0]);
|
||||
|
||||
/*
|
||||
int p = 9;
|
||||
|
||||
vector_t fp[3][3],neutral_line[3],reflection_line[p],star[2*p],outer[2];
|
||||
vector_t rotation_line = {0,0,1};
|
||||
|
||||
cairo_set_line_width(C, 1.5/ctx->dim->scalefactor);
|
||||
cairo_set_source_rgb(C, 1, 0, 0);
|
||||
|
||||
multiply(gen[0], gen[1], rot);
|
||||
|
||||
fixedPoints(ctx, "abc", fp[0]);
|
||||
fixedPoints(ctx, "bca", fp[1]);
|
||||
fixedPoints(ctx, "cab", fp[2]);
|
||||
|
||||
LOOP(i) neutral_line[i] = cross(fp[i][0], fp[i][2]);
|
||||
LOOP(j) reflection_line[0].x[j] = gsl_matrix_get(ctx->cartan, 0, j);
|
||||
star[0] = cross(neutral_line[0],reflection_line[0]);
|
||||
star[p] = cross(neutral_line[2],reflection_line[0]);
|
||||
|
||||
for(int j = 1; j < p; j++) {
|
||||
reflection_line[j] = apply_transpose(rot, reflection_line[j-1]);
|
||||
star[j] = apply(rot, star[j-1]);
|
||||
star[j+p] = apply(rot, star[j+p-1]);
|
||||
}
|
||||
|
||||
outer[0] = cross(neutral_line[0],reflection_line[5]);
|
||||
outer[1] = cross(neutral_line[2],reflection_line[5]);
|
||||
|
||||
for(int j = 0; j < 8; j++) {
|
||||
drawVector(ctx, star[j]);
|
||||
drawVector(ctx, star[p+j]);
|
||||
}
|
||||
|
||||
for(int j = 0; j < 7; j++) {
|
||||
// if(j == 3)
|
||||
// continue;
|
||||
drawSegment(ctx, star[j%p], star[(j+1)%p+p]);
|
||||
drawSegment(ctx, star[(j+1)%p+p], star[(j+1)%p]);
|
||||
drawSegment(ctx, star[(j+1)%p], star[j%p+p]);
|
||||
drawSegment(ctx, star[j%p+p], star[j%p]);
|
||||
}
|
||||
|
||||
cairo_set_source_rgb(C, 0, 0, 1);
|
||||
drawVector(ctx,outer[0]);
|
||||
drawVector(ctx,outer[1]);
|
||||
|
||||
// drawCovector(ctx, neutral_line[0]);
|
||||
// drawCovector(ctx, neutral_line[2]);
|
||||
|
||||
drawSegment(ctx, star[0], star[p]);
|
||||
drawSegment(ctx, star[p], outer[1]);
|
||||
drawSegment(ctx, outer[1], outer[0]);
|
||||
drawSegment(ctx, outer[0], star[0]);
|
||||
|
||||
cairo_set_source_rgb(C, 0, 0, 0);
|
||||
drawCovector(ctx, rotation_line);
|
||||
*/
|
||||
|
||||
// for(int j = 0; j < 5; j++)
|
||||
// drawCovector(ctx, reflection_line[j]);
|
||||
|
||||
// intersect attracting line with neutral line of the other element
|
||||
// for(int j = 0; j < 2; j++)
|
||||
// i[j] = cross(cross(p[j%2][0],p[j%2][1]),cross(p[(j+1)%2][0],p[(j+1)%2][2]));
|
||||
|
||||
// drawPolygon(ctx, 1, 4, p[0][0], i[0], p[1][0], i[1]);
|
||||
|
||||
// abc, ababcba, abababcbaba, ..., cab
|
||||
// bca, acaba, abacababa, ..., babcb
|
||||
/*
|
||||
vector_t v[4][3];
|
||||
vector_t i[4];
|
||||
|
||||
fixedPoints(ctx, "abc", v[0]);
|
||||
fixedPoints(ctx, "bca", v[1]);
|
||||
fixedPoints(ctx, "cab", v[2]);
|
||||
fixedPoints(ctx, "acaba", v[3]);
|
||||
i[0] = cross(cross(v[0][1],v[0][2]),cross(v[2][0],v[2][2]));
|
||||
i[1] = cross(cross(v[1][1],v[1][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]));
|
||||
|
||||
// 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[1][2], i[1], i[2], i[0], v[0][2], i[3]);
|
||||
|
||||
cairo_set_line_width(C, 1.5/ctx->dim->scalefactor);
|
||||
cairo_set_source_rgb(C, 1, 0, 0);
|
||||
// drawBox(ctx, "bca", "abc");
|
||||
|
||||
drawCurvedBox(ctx, 'A', "");
|
||||
*/
|
||||
/*
|
||||
cairo_set_source_rgb(C, 1, 0.5, 0);
|
||||
drawBox(ctx, "ab abc ba", "ab cab ba");
|
||||
drawBox(ctx, "abab abc baba", "abab cab baba");
|
||||
drawBox(ctx, "ababab abc bababa", "ababab cab bababa");
|
||||
drawBox(ctx, "abababab abc babababa", "abababab cab babababa");
|
||||
// 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_restore(C);
|
||||
releaseTempMatrices(ctx->ws, 4);
|
||||
}
|
||||
|
||||
void drawRotatedReflectors(DrawingContext *ctx)
|
||||
@ -1572,7 +1111,6 @@ void draw(DrawingContext *ctx)
|
||||
if(ctx->show_marking)
|
||||
{
|
||||
cairo_set_source_rgb(C, 0, 0, 1);
|
||||
drawPoint(ctx, ctx->marking);
|
||||
}
|
||||
|
||||
if(ctx->show_coxeter_orbit)
|
||||
@ -1582,7 +1120,7 @@ void draw(DrawingContext *ctx)
|
||||
cairo_identity_matrix(C); // text is in screen coordinates
|
||||
|
||||
if(ctx->show_text)
|
||||
drawText(ctx);
|
||||
drawText(ctx);
|
||||
|
||||
cairo_surface_flush(cairo_get_target(C));
|
||||
}
|
||||
|
2
linalg.h
2
linalg.h
@ -13,7 +13,7 @@
|
||||
#define ERROR(condition, msg, ...) if(condition){fprintf(stderr, msg, ##__VA_ARGS__); exit(1);}
|
||||
#define FCMP(x, y) gsl_fcmp(x, y, 1e-10)
|
||||
|
||||
#define MAX_TEMP_MATRICES 600000
|
||||
#define MAX_TEMP_MATRICES 1200000
|
||||
#define MAX_TEMP_VECTORS 100
|
||||
|
||||
typedef struct _workspace {
|
||||
|
13
main.c
13
main.c
@ -350,6 +350,7 @@ int processEvent(GraphicsInfo *info, XEvent *ev)
|
||||
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++) {
|
||||
@ -366,7 +367,17 @@ int processEvent(GraphicsInfo *info, XEvent *ev)
|
||||
cairo_surface_write_to_png(info->buffer_surface, filename);
|
||||
printf("Finished drawing %s\n", filename);
|
||||
}
|
||||
|
||||
*/
|
||||
screen_context->limit_with_lines = 0;
|
||||
for(int i = 0; i <= 1000; i++) {
|
||||
screen_context->parameter = exp(log(3.0)*((double)i/500-1));
|
||||
updateMatrices(screen_context);
|
||||
computeLimitCurve(screen_context);
|
||||
draw(screen_context);
|
||||
sprintf(filename, "output/movie8/test%04d.png", i);
|
||||
// cairo_surface_write_to_png(info->buffer_surface, filename);
|
||||
printf("Finished drawing %s\n", filename);
|
||||
}
|
||||
case 'f':
|
||||
TOGGLE(screen_context->use_repelling);
|
||||
computeLimitCurve(screen_context);
|
||||
|
Loading…
Reference in New Issue
Block a user