X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=hexagon.h;h=9578bdd055611a58ad3f25f9f755050a1d9a65c4;hb=c5a7aa5029146b2bcea5daae53c6aa3e5e33ed04;hp=85683b16d3d902dcd911075c166f38779af6ec07;hpb=b23bb67f8c88ba23499d1c6e7b444b6561aeb49a;p=hexagon diff --git a/hexagon.h b/hexagon.h index 85683b1..9578bdd 100644 --- a/hexagon.h +++ b/hexagon.h @@ -76,6 +76,13 @@ double HL_center_x(int cantor); double HL_center_y(int cantor); int HL_hexcenter(int cantor, double *x, double *y); +/* find a point based on a unit hex, given angle and distance from center, + * where a distance of 1 is on the hex side. probably not useful + * for points outside the hex, that is, distance should almost certainly + * be less than or equal to 1.0 + */ +double HL_polar(double angle, double distance, double *x, double *y); + /* how far is it on the hex grid */ int HL_distance(int from_cantor, int to_cantor); @@ -109,6 +116,10 @@ struct HL_hex { int x,y; /* hmm. would be nice to be able to just point to a generic */ }; +struct hl_point { + double x, y; +}; + /* * Pathfinding */ @@ -129,7 +140,6 @@ struct HL_astar { double (*heuristic)(int,int); int (*neighbor)(int,int); int nodes, allocated; - struct HL_astar_hex *sets; struct HL_astar_hex *open; struct HL_astar_hex *closed; struct HL_astar_hex *from, *to; @@ -141,8 +151,13 @@ int HL_findpath(struct HL_astar *s, int loops); 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); +void HL_vertices(int cantor, double *vc); +extern double HL_vertexv[12]; extern double HL_fand[16]; extern float HL_fanf[16]; +extern double HL_hfand[16]; /* horizontal grids */ +extern float HL_hfanf[16]; /* horizontal grids */ +extern double HL_square; #endif