X-Git-Url: https://pd.if.org/git/?p=hexagon;a=blobdiff_plain;f=hexagon.h;h=9578bdd055611a58ad3f25f9f755050a1d9a65c4;hp=6768a62275e23436e4ce8b29cc35c1cbbdcbd8ba;hb=c5a7aa5029146b2bcea5daae53c6aa3e5e33ed04;hpb=ce4fd67e5bfd07192ca5cb357798aaa3588512e4 diff --git a/hexagon.h b/hexagon.h index 6768a62..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; @@ -143,6 +153,7 @@ 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 */