From: Nathan Wagner Date: Mon, 13 Dec 2010 05:47:36 +0000 (+0000) Subject: Added HL_fan[df] for opengl rendering support. X-Git-Url: https://pd.if.org/git/?p=hexagon;a=commitdiff_plain;h=b23bb67f8c88ba23499d1c6e7b444b6561aeb49a Added HL_fan[df] for opengl rendering support. --- diff --git a/hexagon.c b/hexagon.c index 61bb47b..123e5cf 100644 --- a/hexagon.c +++ b/hexagon.c @@ -12,7 +12,7 @@ static int inversecantor(int cantor, int *x, int *y); * domain */ -double HL_vertexv[] = { +double HL_vertexv[12] = { .577350269189625764509148780502, 0.0, .288675134594812882254574390251, 0.5, -.288675134594812882254574390251, 0.5, @@ -20,6 +20,28 @@ double HL_vertexv[] = { -.288675134594812882254574390251, -0.5, .288675134594812882254574390251, -0.5}; +double HL_fand[16] = { + 0.0, 0.0, + .577350269189625764509148780502, 0.0, + .288675134594812882254574390251, 0.5, + -.288675134594812882254574390251, 0.5, + -.577350269189625764509148780502, 0.0, + -.288675134594812882254574390251, -0.5, + .288675134594812882254574390251, -0.5, + .577350269189625764509148780502, 0.0 +}; + +float HL_fanf[16] = { + 0.0f, 0.0f, + .577350269189625764509148780502f, 0.0f, + .288675134594812882254574390251f, 0.5f, + -.288675134594812882254574390251f, 0.5f, + -.577350269189625764509148780502f, 0.0f, + -.288675134594812882254574390251f, -0.5f, + .288675134594812882254574390251f, -0.5f, + .577350269189625764509148780502f, 0.0f +}; + /* these all are for a hex one unit across */ static double hexptvd[6][2] = { {.577350269189625764509148780502, 0.0}, /* 1.0/sqrt3 */ diff --git a/hexagon.h b/hexagon.h index 50665d0..85683b1 100644 --- a/hexagon.h +++ b/hexagon.h @@ -142,4 +142,7 @@ void HL_astar_free(struct HL_astar *s); struct HL_astar *HL_astar_clear(struct HL_astar *s); struct HL_astar *HL_astar_init(struct HL_astar *s); +extern double HL_fand[16]; +extern float HL_fanf[16]; + #endif diff --git a/t/cantor.c b/t/cantor.c index 0f179d2..e6ce28f 100644 --- a/t/cantor.c +++ b/t/cantor.c @@ -10,7 +10,7 @@ int main(void) { int hex; int x, y; - plan_tests(81*2); + plan_tests(81*4); for (x=-4;x<=4;x++) { for (y=-4;y<=4;y++) { @@ -18,6 +18,8 @@ int main(void) { HL_cantor_arrays(hex, xy, ijk); ok(x == xy[0], "x check %d %d", x, y); ok(y == xy[1], "y check %d %d", x, y); + ok(x == HL_cantor_x(hex), "reverse check x %d %d",hex,x); + ok(x == HL_cantor_x(hex), "reverse check y %d %d",hex,y); } }