draw rotation orbit
This commit is contained in:
21
main.c
21
main.c
@@ -62,12 +62,12 @@ void computeRotationMatrix(DrawingContext *ctx, gsl_matrix *result, const char *
|
||||
gsl_matrix *tmp = getTempMatrix(ctx->ws);
|
||||
gsl_matrix **gen = getTempMatrices(ctx->ws, 3);
|
||||
|
||||
ERROR(strlen(type) != 2, "Invalid call of computeRotationMatrix()\n");
|
||||
// ERROR(strlen(type) != 2, "Invalid call of computeRotationMatrix()\n");
|
||||
|
||||
initializeTriangleGenerators(gen, ctx->cartan);
|
||||
gsl_matrix_set_identity(tmp);
|
||||
multiply_right(tmp, gen[type[0]-'a'], ctx->ws);
|
||||
multiply_right(tmp, gen[type[1]-'a'], ctx->ws);
|
||||
for(int i = 0; i < strlen(type); i++)
|
||||
multiply_right(tmp, gen[type[i]-'a'], ctx->ws);
|
||||
|
||||
rotation_frame(tmp, result, ctx->ws);
|
||||
|
||||
@@ -130,13 +130,18 @@ void updateMatrices(DrawingContext *ctx)
|
||||
LOOP(i) angle[i] = M_PI*ctx->k[i]/ctx->p[i];
|
||||
cartanMatrix(ctx->cartan, angle[0], angle[1], angle[2], ctx->parameter);
|
||||
|
||||
if(ctx->use_rotation_basis) {
|
||||
// computeRotationMatrix(ctx, ctx->cob, "ac"); // and don't forget to invert!
|
||||
computeBoxTransform(ctx, "abc", "cab", ctx->cob);
|
||||
} else {
|
||||
gsl_matrix *tmp = getTempMatrix(ctx->ws);
|
||||
|
||||
if(ctx->use_rotation_basis % 3 == 0) {
|
||||
gsl_matrix_memcpy(ctx->cob, ctx->cartan); // is this a good choice of basis for any reason?
|
||||
} else if(ctx->use_rotation_basis % 3 == 1) {
|
||||
computeRotationMatrix(ctx, tmp, "ac");
|
||||
invert(tmp, ctx->cob, ctx->ws);
|
||||
} else {
|
||||
computeBoxTransform(ctx, "abc", "cab", ctx->cob);
|
||||
}
|
||||
|
||||
releaseTempMatrices(ctx->ws, 1);
|
||||
}
|
||||
|
||||
void print(DrawingContext *screen)
|
||||
@@ -249,7 +254,7 @@ int processEvent(GraphicsInfo *info, XEvent *ev)
|
||||
TOGGLE(screen_context->show_limit);
|
||||
break;
|
||||
case 'R':
|
||||
TOGGLE(screen_context->use_rotation_basis);
|
||||
screen_context->use_rotation_basis++;
|
||||
updateMatrices(screen_context);
|
||||
computeLimitCurve(screen_context);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user