measure asymmetric distance
This commit is contained in:
parent
35932782e9
commit
ca8799702d
465
draw.c
465
draw.c
@ -22,6 +22,13 @@ vector_t cross(vector_t a, vector_t b)
|
||||
return result;
|
||||
}
|
||||
|
||||
double scal(vector_t a, vector_t b)
|
||||
{
|
||||
double result = 0.0;
|
||||
LOOP(i) result += a.x[i]*b.x[i];
|
||||
return result;
|
||||
}
|
||||
|
||||
vector_t apply(gsl_matrix *m, vector_t x)
|
||||
{
|
||||
vector_t out;
|
||||
@ -42,6 +49,21 @@ vector_t apply_transpose(gsl_matrix *m, vector_t x)
|
||||
return out;
|
||||
}
|
||||
|
||||
vector_t apply_inverse(gsl_matrix *m, vector_t in)
|
||||
{
|
||||
vector_t out;
|
||||
double cofactor;
|
||||
|
||||
LOOP(i) out.x[i] = 0.0;
|
||||
LOOP(i) LOOP(j) {
|
||||
cofactor = gsl_matrix_get(m, (i+1)%3, (j+1)%3) * gsl_matrix_get(m, (i+2)%3, (j+2)%3)
|
||||
- gsl_matrix_get(m, (i+1)%3, (j+2)%3) * gsl_matrix_get(m, (i+2)%3, (j+1)%3);
|
||||
out.x[i] += cofactor * in.x[j];
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
int fixedPoints(DrawingContext *ctx, const char *word, vector_t *out)
|
||||
{
|
||||
gsl_matrix *tmp = getTempMatrix(ctx->ws);
|
||||
@ -886,10 +908,31 @@ void drawBoxes(DrawingContext *ctx)
|
||||
releaseTempMatrices(ctx->ws, 5);
|
||||
}
|
||||
|
||||
void getMinMaxHalfCrossRatio(double *limit_curve, int n, vector_t v1, vector_t v2, int max, int *min_index, double* min_cr)
|
||||
{
|
||||
vector_t fp[3];
|
||||
vector_t tangent;
|
||||
double cr;
|
||||
*min_cr = max ? 0 : INFINITY;
|
||||
for(int i = 0; i < n; i++) {
|
||||
LOOP(j) LOOP(k) fp[j].x[k] = limit_curve[12*i+3+3*j+k];
|
||||
tangent = cross(fp[0],fp[1]);
|
||||
|
||||
cr = fabs(scal(v1, tangent) / scal(v2, tangent));
|
||||
if(!max && cr < *min_cr || max && cr > *min_cr) {
|
||||
*min_cr = cr;
|
||||
*min_index = i;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void drawBoxes2(DrawingContext *ctx)
|
||||
{
|
||||
gsl_matrix *rot = getTempMatrix(ctx->ws);
|
||||
gsl_matrix **gen = getTempMatrices(ctx->ws, 3);
|
||||
gsl_vector *marking_globalbasis = getTempVector(ctx->ws);
|
||||
gsl_vector *marking_drawbasis = getTempVector(ctx->ws);
|
||||
cairo_t *C = ctx->cairo;
|
||||
cairo_save(C);
|
||||
initializeTriangleGenerators(gen, ctx->cartan);
|
||||
@ -900,369 +943,95 @@ void drawBoxes2(DrawingContext *ctx)
|
||||
fixedPoints(ctx, "bca", p[1]);
|
||||
fixedPoints(ctx, "cab", p[2]);
|
||||
|
||||
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_line_width(C, 1/ctx->dim->scalefactor);
|
||||
|
||||
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);
|
||||
vector_t att_line[3];
|
||||
vector_t rep_line[3];
|
||||
|
||||
// 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);
|
||||
LOOP(i) att_line[i] = cross(p[i][0], p[i][1]);
|
||||
LOOP(i) rep_line[i] = cross(p[i][2], p[i][1]);
|
||||
|
||||
if(ctx->mode >= 3 && ctx->mode != 4) {
|
||||
cairo_set_source_rgb(C, 0, 0, 0);
|
||||
drawCurvedBox(ctx, 'B', "", 2);
|
||||
drawCurvedBox(ctx, 'C', "", 2);
|
||||
}
|
||||
vector_t vertex[3];
|
||||
LOOP(i) vertex[i] = cross(
|
||||
cross(p[(i+1)%3][0],p[(i+1)%3][2]),
|
||||
cross(p[(i+2)%3][0],p[(i+2)%3][2]));
|
||||
|
||||
if(ctx->mode == 4 || ctx->mode == 5) {
|
||||
cairo_set_source_rgb(C, 0, 0.8, 0.5);
|
||||
drawCurvedBox(ctx, 'A', "", 2);
|
||||
drawCurvedBox(ctx, 'A', "bc", 2);
|
||||
drawCurvedBox(ctx, 'A', "bcbc", 2);
|
||||
drawCurvedBox(ctx, 'A', "bcbcbc", 2);
|
||||
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);
|
||||
}
|
||||
LOOP(i) drawVector(ctx, vertex[i]);
|
||||
// LOOP(i) drawCovector(ctx, att_line[i]);
|
||||
|
||||
if(ctx->mode == 6) {
|
||||
cairo_set_source_rgb(C, 0, 0.8, 0.5);
|
||||
drawCurvedBox(ctx, 'C', "abababab", 2);
|
||||
drawCurvedBox(ctx, 'C', "ababababab", 2);
|
||||
}
|
||||
|
||||
if(ctx->mode >= 6) {
|
||||
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);
|
||||
|
||||
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', "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', "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', "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);
|
||||
}
|
||||
|
||||
// drawCurvedBox(ctx, 'B', "abab", 2);
|
||||
// drawCurvedBox(ctx, 'B', "ababab", 2);
|
||||
double half_cross_ratio[3];
|
||||
LOOP(i) half_cross_ratio[i] = scal(vertex[(i+1)%3],att_line[i])/scal(vertex[(i+2)%3],att_line[i]);
|
||||
double triple_ratio = half_cross_ratio[0]*half_cross_ratio[1]*half_cross_ratio[2];
|
||||
LOOP(i) half_cross_ratio[i] = scal(vertex[(i+1)%3],rep_line[i])/scal(vertex[(i+2)%3],rep_line[i]);
|
||||
double triple_ratio2 = half_cross_ratio[0]*half_cross_ratio[1]*half_cross_ratio[2];
|
||||
|
||||
|
||||
|
||||
// drawCurvedBox(ctx, 'C', "b", 1);
|
||||
vector_t marking, marking2, marking3;
|
||||
gsl_vector_set(marking_drawbasis, 0, ctx->marking.x);
|
||||
gsl_vector_set(marking_drawbasis, 1, ctx->marking.y);
|
||||
gsl_vector_set(marking_drawbasis, 2, 1);
|
||||
solve(ctx->cob, marking_drawbasis, marking_globalbasis, ctx->ws);
|
||||
LOOP(i) marking.x[i] = gsl_vector_get(marking_globalbasis, i);
|
||||
|
||||
// drawCurvedBox(ctx, 'C', "ababab");
|
||||
// drawCurvedBox(ctx, 'C', "abababab");
|
||||
// drawCurvedBox(ctx, 'C', "b");
|
||||
// drawCurvedBox(ctx, 'C', "bab");
|
||||
// drawCurvedBox(ctx, 'C', "babab");
|
||||
gsl_vector_set(marking_drawbasis, 0, ctx->marking2.x);
|
||||
gsl_vector_set(marking_drawbasis, 1, ctx->marking2.y);
|
||||
gsl_vector_set(marking_drawbasis, 2, 1);
|
||||
solve(ctx->cob, marking_drawbasis, marking_globalbasis, ctx->ws);
|
||||
LOOP(i) marking2.x[i] = gsl_vector_get(marking_globalbasis, i);
|
||||
|
||||
// drawCurvedBox(ctx, 'C', "abababab");
|
||||
// drawCurvedBox(ctx, 'C', "ababababab");
|
||||
// drawCurvedBox(ctx, 'C', "abababababab");
|
||||
gsl_vector_set(marking_drawbasis, 0, ctx->marking3.x);
|
||||
gsl_vector_set(marking_drawbasis, 1, ctx->marking3.y);
|
||||
gsl_vector_set(marking_drawbasis, 2, 1);
|
||||
solve(ctx->cob, marking_drawbasis, marking_globalbasis, ctx->ws);
|
||||
LOOP(i) marking3.x[i] = gsl_vector_get(marking_globalbasis, i);
|
||||
|
||||
|
||||
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");
|
||||
/*
|
||||
vector_t line_drawbasis = apply_inverse(ctx->cob, cross(marking, vertex[0]));
|
||||
double last, current;
|
||||
int boundary_points[2] = {0,0};
|
||||
int current_boundary_point = 0;
|
||||
last =
|
||||
ctx->limit_curve[12*(ctx->n_group_elements-1) ]*line_drawbasis.x[0] +
|
||||
ctx->limit_curve[12*(ctx->n_group_elements-1)+1]*line_drawbasis.x[1] +
|
||||
line_drawbasis.x[2];
|
||||
*/
|
||||
|
||||
// drawCurvedBox(ctx, 'A', "ababc");
|
||||
|
||||
cairo_set_source_rgb(C, 1, 0.5, 0);
|
||||
// drawCurvedBox(ctx, 'C', "abcabcab");
|
||||
double value[6];
|
||||
int boundary_point[6];
|
||||
getMinMaxHalfCrossRatio(ctx->limit_curve, ctx->n_group_elements,
|
||||
marking, marking2, 1, &boundary_point[0], &value[0]);
|
||||
getMinMaxHalfCrossRatio(ctx->limit_curve, ctx->n_group_elements,
|
||||
marking2, marking3, 1, &boundary_point[1], &value[1]);
|
||||
getMinMaxHalfCrossRatio(ctx->limit_curve, ctx->n_group_elements,
|
||||
marking3, marking, 1, &boundary_point[2], &value[2]);
|
||||
getMinMaxHalfCrossRatio(ctx->limit_curve, ctx->n_group_elements,
|
||||
marking, marking2, 0, &boundary_point[0], &value[3]);
|
||||
getMinMaxHalfCrossRatio(ctx->limit_curve, ctx->n_group_elements,
|
||||
marking2, marking3, 0, &boundary_point[1], &value[4]);
|
||||
getMinMaxHalfCrossRatio(ctx->limit_curve, ctx->n_group_elements,
|
||||
marking3, marking, 0, &boundary_point[2], &value[5]);
|
||||
|
||||
/* vector_t fp[3], tangent;
|
||||
LOOP(j) LOOP(k) fp[j].x[k] = ctx->limit_curve[12*boundary_point[0]+3+3*j+k];
|
||||
tangent = cross(fp[0],fp[1]);
|
||||
drawCovector(ctx, tangent);*/
|
||||
|
||||
// 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");
|
||||
snprintf(ctx->extra_text, 1000, "tr1 = %f, tr2 2 = %f, aa = %f",
|
||||
log(value[0])+log(value[1])+log(value[2]),
|
||||
-log(value[3])-log(value[4])-log(value[5]),
|
||||
log(value[0])+log(value[1])+log(value[2])+log(value[3])+log(value[4])+log(value[5]));
|
||||
|
||||
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");
|
||||
*/
|
||||
drawCovector(ctx, cross(marking, marking2));
|
||||
drawCovector(ctx, cross(marking2, marking3));
|
||||
drawCovector(ctx, cross(marking3, marking));
|
||||
|
||||
cairo_restore(C);
|
||||
releaseTempMatrices(ctx->ws, 4);
|
||||
releaseTempVectors(ctx->ws, 2);
|
||||
}
|
||||
|
||||
void drawRotatedReflectors(DrawingContext *ctx)
|
||||
@ -1400,8 +1169,8 @@ void drawLimitCurve(DrawingContext *ctx)
|
||||
|
||||
for(int i = 0; i < ctx->limit_curve_count; i++) {
|
||||
point_t p;
|
||||
p.x = ctx->limit_curve[3*i];
|
||||
p.y = ctx->limit_curve[3*i+1];
|
||||
p.x = ctx->limit_curve[12*i];
|
||||
p.y = ctx->limit_curve[12*i+1];
|
||||
|
||||
if(isInsideBB(ctx, p)) {
|
||||
if(!previous_inside)
|
||||
@ -1418,8 +1187,8 @@ void drawLimitCurve(DrawingContext *ctx)
|
||||
} else {
|
||||
for(int i = 0; i < ctx->limit_curve_count; i++) {
|
||||
point_t p;
|
||||
p.x = ctx->limit_curve[3*i];
|
||||
p.y = ctx->limit_curve[3*i+1];
|
||||
p.x = ctx->limit_curve[12*i];
|
||||
p.y = ctx->limit_curve[12*i+1];
|
||||
|
||||
if(isInsideBB(ctx, p)) {
|
||||
cairo_arc(C, p.x, p.y, 2.0/ctx->dim->scalefactor, 0, 2*M_PI);
|
||||
@ -1525,8 +1294,8 @@ void drawText(DrawingContext *ctx)
|
||||
{
|
||||
cairo_move_to(ctx->cairo, 15, 30);
|
||||
cairo_set_source_rgb(ctx->cairo, 0, 0, 0);
|
||||
char buf[100];
|
||||
sprintf(buf, "t = exp(%.8f) = %.8f, marking = (%.5f, %.5f)", log(ctx->parameter), ctx->parameter, ctx->marking.x, ctx->marking.y);
|
||||
char buf[1000];
|
||||
snprintf(buf, 1000, "t = exp(%.8f) = %.8f, %s", log(ctx->parameter), ctx->parameter, ctx->extra_text);
|
||||
cairo_show_text(ctx->cairo, buf);
|
||||
}
|
||||
|
||||
@ -1573,6 +1342,8 @@ void draw(DrawingContext *ctx)
|
||||
{
|
||||
cairo_set_source_rgb(C, 0, 0, 1);
|
||||
drawPoint(ctx, ctx->marking);
|
||||
drawPoint(ctx, ctx->marking2);
|
||||
drawPoint(ctx, ctx->marking3);
|
||||
}
|
||||
|
||||
if(ctx->show_coxeter_orbit)
|
||||
|
11
limit_set.c
11
limit_set.c
@ -63,7 +63,7 @@ int computeLimitCurve(DrawingContext *ctx)
|
||||
|
||||
for(int i = 0; i < ctx->n_group_elements; i++) {
|
||||
multiply_many(ws, fixedpoints_pos, 3, cob_pos, elements[i], coxeter_fixedpoints_pos);
|
||||
ctx->limit_curve[3*i+2] = atan2(
|
||||
ctx->limit_curve[12*i+2] = atan2(
|
||||
gsl_matrix_get(fixedpoints_pos, 2, column)/gsl_matrix_get(fixedpoints_pos, 0, column),
|
||||
gsl_matrix_get(fixedpoints_pos, 1, column)/gsl_matrix_get(fixedpoints_pos, 0, column));
|
||||
}
|
||||
@ -85,8 +85,8 @@ int computeLimitCurve(DrawingContext *ctx)
|
||||
for(int i = 0; i < ctx->n_group_elements; i++) {
|
||||
multiply_many(ws, fixedpoints, 3, ctx->cob, elements[i], coxeter_fixedpoints);
|
||||
|
||||
x = ctx->limit_curve[3*i ] = gsl_matrix_get(fixedpoints, 0, column)/gsl_matrix_get(fixedpoints, 2, column);
|
||||
y = ctx->limit_curve[3*i+1] = gsl_matrix_get(fixedpoints, 1, column)/gsl_matrix_get(fixedpoints, 2, column);
|
||||
x = ctx->limit_curve[12*i ] = gsl_matrix_get(fixedpoints, 0, column)/gsl_matrix_get(fixedpoints, 2, column);
|
||||
y = ctx->limit_curve[12*i+1] = gsl_matrix_get(fixedpoints, 1, column)/gsl_matrix_get(fixedpoints, 2, column);
|
||||
|
||||
if((x - ctx->marking.x)*(x - ctx->marking.x) + (y - ctx->marking.y)*(y - ctx->marking.y) < 25e-10)
|
||||
{
|
||||
@ -96,11 +96,14 @@ int computeLimitCurve(DrawingContext *ctx)
|
||||
fputc('\n',stdout);
|
||||
}
|
||||
|
||||
multiply_many(ws, fixedpoints, 2, elements[i], coxeter_fixedpoints);
|
||||
LOOP(j) LOOP(k) ctx->limit_curve[12*i+3+3*j+k] = gsl_matrix_get(fixedpoints, k, j);
|
||||
|
||||
// bca abc acb = abc
|
||||
|
||||
}
|
||||
|
||||
qsort(ctx->limit_curve, ctx->n_group_elements, 3*sizeof(double), compareAngle);
|
||||
qsort(ctx->limit_curve, ctx->n_group_elements, 12*sizeof(double), compareAngle);
|
||||
|
||||
ctx->limit_curve_count = ctx->n_group_elements;
|
||||
|
||||
|
28
main.c
28
main.c
@ -45,9 +45,15 @@ void setupContext(DrawingContext *ctx, int argc, char *argv[])
|
||||
ctx->show_marking = 1;
|
||||
ctx->marking.x = -0.73679;
|
||||
ctx->marking.y = -0.01873;
|
||||
ctx->marking2.x = -0.73679;
|
||||
ctx->marking2.y = -0.11873;
|
||||
ctx->marking3.x = -0.73679;
|
||||
ctx->marking3.y = -0.21873;
|
||||
ctx->show_coxeter_orbit = 0;
|
||||
ctx->extra_text = malloc(1000*sizeof(char));
|
||||
memset(ctx->extra_text, 0, 1000*sizeof(char));
|
||||
|
||||
ctx->limit_curve = malloc(3*ctx->n_group_elements*sizeof(double));
|
||||
ctx->limit_curve = malloc(12*ctx->n_group_elements*sizeof(double));
|
||||
ctx->limit_curve_count = -1;
|
||||
|
||||
ctx->group = malloc(ctx->n_group_elements*sizeof(groupelement_t));
|
||||
@ -63,6 +69,7 @@ void destroyContext(DrawingContext *ctx)
|
||||
{
|
||||
free(ctx->limit_curve);
|
||||
free(ctx->group);
|
||||
free(ctx->extra_text);
|
||||
|
||||
gsl_matrix_free(ctx->cartan);
|
||||
gsl_matrix_free(ctx->cob);
|
||||
@ -230,7 +237,7 @@ int processEvent(GraphicsInfo *info, XEvent *ev)
|
||||
case ButtonPress:
|
||||
state = ev->xbutton.state & (ShiftMask | LockMask | ControlMask);
|
||||
|
||||
if(ev->xbutton.button == 1 && state & ShiftMask) {
|
||||
if(ev->xbutton.button == 1 && state & ShiftMask && state & ControlMask) {
|
||||
screen_context->marking.x = (double)ev->xbutton.x;
|
||||
screen_context->marking.y = (double)ev->xbutton.y;
|
||||
printf("mouse button pressed: %f, %f\n", screen_context->marking.x, screen_context->marking.y);
|
||||
@ -238,7 +245,24 @@ int processEvent(GraphicsInfo *info, XEvent *ev)
|
||||
cairo_device_to_user(screen_context->cairo, &screen_context->marking.x, &screen_context->marking.y);
|
||||
printf("mouse button pressed transformed: %f, %f\n", screen_context->marking.x, screen_context->marking.y);
|
||||
return STATUS_REDRAW;
|
||||
} else if(ev->xbutton.button == 1 && state & ControlMask) {
|
||||
screen_context->marking2.x = (double)ev->xbutton.x;
|
||||
screen_context->marking2.y = (double)ev->xbutton.y;
|
||||
printf("mouse button pressed: %f, %f\n", screen_context->marking2.x, screen_context->marking2.y);
|
||||
cairo_set_matrix(screen_context->cairo, &screen_context->dim->matrix);
|
||||
cairo_device_to_user(screen_context->cairo, &screen_context->marking2.x, &screen_context->marking2.y);
|
||||
printf("mouse button pressed transformed: %f, %f\n", screen_context->marking2.x, screen_context->marking2.y);
|
||||
return STATUS_REDRAW;
|
||||
} else if(ev->xbutton.button == 1 && state & ShiftMask) {
|
||||
screen_context->marking3.x = (double)ev->xbutton.x;
|
||||
screen_context->marking3.y = (double)ev->xbutton.y;
|
||||
printf("mouse button pressed: %f, %f\n", screen_context->marking3.x, screen_context->marking3.y);
|
||||
cairo_set_matrix(screen_context->cairo, &screen_context->dim->matrix);
|
||||
cairo_device_to_user(screen_context->cairo, &screen_context->marking3.x, &screen_context->marking3.y);
|
||||
printf("mouse button pressed transformed: %f, %f\n", screen_context->marking3.x, screen_context->marking3.y);
|
||||
return STATUS_REDRAW;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case KeyPress:
|
||||
|
Loading…
Reference in New Issue
Block a user