computeRotationMatrix
This commit is contained in:
parent
91bd66f057
commit
c322a2ce7a
28
main.c
28
main.c
@ -57,23 +57,18 @@ void destroyContext(DrawingContext *ctx)
|
||||
workspace_free(ctx->ws);
|
||||
}
|
||||
|
||||
void updateMatrices(DrawingContext *ctx)
|
||||
void computeRotationMatrix(DrawingContext *ctx, gsl_matrix *result, const char *type)
|
||||
{
|
||||
double angle[3];
|
||||
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)
|
||||
gsl_matrix_memcpy(ctx->cob, ctx->cartan); // is this a good choice of basis
|
||||
else {
|
||||
gsl_matrix *tmp = getTempMatrix(ctx->ws);
|
||||
gsl_matrix *rot_basis = getTempMatrix(ctx->ws);
|
||||
gsl_matrix **gen = getTempMatrices(ctx->ws, 3);
|
||||
|
||||
ERROR(strlen(type) != 2, "Invalid call of computeRotationMatrix()\n");
|
||||
|
||||
initializeTriangleGenerators(gen, ctx->cartan);
|
||||
gsl_matrix_set_identity(tmp);
|
||||
multiply_right(tmp, gen[0], ctx->ws);
|
||||
multiply_right(tmp, gen[2], ctx->ws);
|
||||
multiply_right(tmp, gen[type[0]-'a'], ctx->ws);
|
||||
multiply_right(tmp, gen[type[1]-'b'], ctx->ws);
|
||||
|
||||
gsl_eigen_nonsymmv_params(0, ctx->ws->work_nonsymmv);
|
||||
int r = gsl_eigen_nonsymmv(tmp, ctx->ws->eval_complex, ctx->ws->evec_complex, ctx->ws->work_nonsymmv);
|
||||
@ -88,10 +83,21 @@ void updateMatrices(DrawingContext *ctx)
|
||||
gsl_matrix_set(tmp, i, 2, GSL_REAL(z));
|
||||
}
|
||||
|
||||
invert(tmp, ctx->cob, ctx->ws);
|
||||
invert(tmp, result, ctx->ws);
|
||||
|
||||
releaseTempMatrices(ctx->ws, 5);
|
||||
}
|
||||
|
||||
void updateMatrices(DrawingContext *ctx)
|
||||
{
|
||||
double angle[3];
|
||||
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");
|
||||
else
|
||||
gsl_matrix_memcpy(ctx->cob, ctx->cartan); // is this a good choice of basis for any reason?
|
||||
}
|
||||
|
||||
void print(DrawingContext *screen)
|
||||
|
2
main.h
2
main.h
@ -66,6 +66,7 @@ void drawSegment(DrawingContext *ctx, vector_t a, vector_t b);
|
||||
void drawPolygon(DrawingContext *ctx, int segments, int sides, ...);
|
||||
void drawTriangle(DrawingContext *ctx, const char *word);
|
||||
void drawBox(DrawingContext *ctx, const char *word1, const char *word2);
|
||||
void drawBoxLines(DrawingContext *ctx, const char *word1, const char *word2);
|
||||
void drawBoxStd(DrawingContext *ctx, const char *word, char base);
|
||||
void drawReflectors(DrawingContext *ctx);
|
||||
void drawAttractors(DrawingContext *ctx);
|
||||
@ -80,6 +81,7 @@ void setupContext(DrawingContext *ctx);
|
||||
void destroyContext(DrawingContext *ctx);
|
||||
void print(DrawingContext *screen);
|
||||
int processEvent(GraphicsInfo *info, XEvent *ev);
|
||||
void computeRotationMatrix(DrawingContext *ctx, gsl_matrix *result, const char *type);
|
||||
void updateMatrices(DrawingContext *ctx);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user