triangle_group_limit_set/main.h

118 lines
3.1 KiB
C
Raw Normal View History

2019-02-03 12:18:14 +00:00
#ifndef TRIANGLE_GROUP_MAIN_H
#define TRIANGLE_GROUP_MAIN_H
2019-02-24 07:43:52 +00:00
#include <gsl/gsl_linalg.h>
2019-02-03 12:18:14 +00:00
#include "triangle.h"
#include "linalg.h"
#include "initcairo.h"
#undef ERROR
#define ERROR(condition, msg, ...) if(condition){fprintf(stderr, msg, ##__VA_ARGS__); exit(1);}
#define LOOP(i) for(int i = 0; i < 3; i++)
#define NUM_GROUP_ELEMENTS 50000
typedef struct {
double x[3];
} vector_t;
typedef struct {
double x;
double y;
} point_t;
typedef struct {
// infos about the screen to draw on
cairo_t *cairo;
DimensionsInfo *dim;
// a priori parameter
int p[3],k[3];
double parameter;
int n_group_elements;
int show_boxes;
2019-02-08 12:03:05 +00:00
int show_boxes2;
2019-02-03 12:18:14 +00:00
int show_attractors;
int show_reflectors;
2019-12-23 11:29:50 +00:00
int show_rotated_reflectors;
2019-02-03 12:18:14 +00:00
int show_limit;
2019-12-23 11:29:50 +00:00
int show_dual_limit;
int show_text;
2021-11-05 13:11:06 +00:00
int mode;
2019-02-11 14:20:56 +00:00
int use_rotation_basis;
2019-02-03 12:18:14 +00:00
int limit_with_lines;
2021-11-05 13:11:06 +00:00
int show_marking;
point_t marking;
2022-03-09 21:07:11 +00:00
point_t marking2;
point_t marking3;
2021-11-05 13:11:06 +00:00
int show_coxeter_orbit;
2019-02-03 12:18:14 +00:00
int use_repelling;
gsl_matrix *cartan, *cob;
2022-03-09 21:07:11 +00:00
char *extra_text;
2019-02-03 12:18:14 +00:00
// precomputed and constant
groupelement_t *group;
// computed stuff
double *limit_curve; // x, y, angle triples
2019-12-23 11:29:50 +00:00
int limit_curve_count;
2019-02-03 12:18:14 +00:00
// temporary; matrices can only be freed from the top, but that's enough for us
workspace_t *ws;
} DrawingContext;
2019-12-23 11:29:50 +00:00
typedef enum {
VT_POINT,
VT_LINE
} vector_type_t;
2019-02-03 12:18:14 +00:00
// implemented in limit_set.c
void cartanMatrix(gsl_matrix *cartan, double a1, double a2, double a3, double s);
void initializeTriangleGenerators(gsl_matrix **gen, gsl_matrix *cartan);
int computeLimitCurve(DrawingContext *ctx);
// implemented in draw.c
vector_t cross(vector_t a, vector_t b);
int fixedPoints(DrawingContext *ctx, const char *word, vector_t *out);
void drawPoint(DrawingContext *ctx, point_t p);
void drawSegment2d(DrawingContext *ctx, point_t a, point_t b);
2021-11-05 13:11:06 +00:00
point_t vectorToPoint(DrawingContext *ctx, vector_t v);
2019-02-03 12:18:14 +00:00
void drawVector(DrawingContext *ctx, vector_t v);
void drawCovector(DrawingContext *ctx, vector_t v);
void drawSegment(DrawingContext *ctx, vector_t a, vector_t b);
2019-02-11 14:20:56 +00:00
void drawPolygon(DrawingContext *ctx, int segments, int sides, ...);
2019-02-03 12:18:14 +00:00
void drawTriangle(DrawingContext *ctx, const char *word);
void drawBox(DrawingContext *ctx, const char *word1, const char *word2);
2019-02-11 14:28:37 +00:00
void drawBoxLines(DrawingContext *ctx, const char *word1, const char *word2);
2019-02-03 12:18:14 +00:00
void drawBoxStd(DrawingContext *ctx, const char *word, char base);
void drawReflectors(DrawingContext *ctx);
void drawAttractors(DrawingContext *ctx);
void drawBoxes(DrawingContext *ctx);
2019-02-08 12:03:05 +00:00
void drawBoxes2(DrawingContext *ctx);
2019-02-03 12:18:14 +00:00
void drawLimitCurve(DrawingContext *ctx);
void drawText(DrawingContext *ctx);
void draw(DrawingContext *ctx);
// implemented in main.c
2021-11-05 13:11:06 +00:00
void setupContext(DrawingContext *ctx, int argc, char *argv[]);
2019-02-03 12:18:14 +00:00
void destroyContext(DrawingContext *ctx);
void print(DrawingContext *screen);
int processEvent(GraphicsInfo *info, XEvent *ev);
2019-02-11 14:28:37 +00:00
void computeRotationMatrix(DrawingContext *ctx, gsl_matrix *result, const char *type);
2019-02-03 12:18:14 +00:00
void updateMatrices(DrawingContext *ctx);
2019-02-24 07:43:52 +00:00
static vector_t vectorFromGsl(gsl_vector *v)
{
vector_t result;
LOOP(i) result.x[i] = gsl_vector_get(v, i);
return result;
}
static void vectorToGsl(vector_t v, gsl_vector *out)
{
LOOP(i) gsl_vector_set(out, i, v.x[i]);
}
2019-02-03 12:18:14 +00:00
#endif