.577350269189625764509148780502, 0.0
};
+double HL_hfand[16] = {
+ 0.0, 0.0,
+ 0.0, .577350269189625764509148780502,
+ 0.5, .288675134594812882254574390251,
+ 0.5, -.288675134594812882254574390251,
+ 0.0, -.577350269189625764509148780502,
+ -0.5, -.288675134594812882254574390251,
+ -0.5, .288675134594812882254574390251,
+ 0.0, .577350269189625764509148780502
+};
+
float HL_fanf[16] = {
0.0f, 0.0f,
.577350269189625764509148780502f, 0.0f,
.577350269189625764509148780502f, 0.0f
};
+float HL_hfanf[16] = {
+ 0.0f, 0.0f,
+ 0.0f, .577350269189625764509148780502f,
+ 0.5f, .288675134594812882254574390251f,
+ 0.5f, -.288675134594812882254574390251f,
+ 0.0f, -.577350269189625764509148780502f,
+ -0.5f, -.288675134594812882254574390251f,
+ -0.5f, .288675134594812882254574390251f,
+ 0.0f, .577350269189625764509148780502f
+};
+
/* size of a square that will exactly fit in a hexagon */
/* 2.0/(1+sqrt(3.0)) */
double HL_square = .73205080756887729352;
#endif
+#define COS30 (.866025403784438646763723170752)
+
int HL_hexbin(double width, double x, double y, int *i, int *j) {
double z, rx, ry, rz;
double abs_dx, abs_dy, abs_dz;
int ix, iy, iz, s;
struct hex h;
- /* TODO just hard-code this cosine */
- x = x / cos(30 * M_PI / 180.0); /* rotated X coord */
+ /*x = x / cos(30 * M_PI / 180.0); */ /* rotated X coord */
+ x = x / COS30;
y = y - x / 2.0; /* adjustment for rotated X */
/* adjust for actual hexwidth */