#include #include "hexagon.h" #include "ctap.h" #define EPS 0.00000001 int main(void) { int x, y; struct HL_hex start; struct HL_point center; double stride; stride = 1.5 / sqrt(3.0); plan(6); x = 0; y = 0; start = HL_hex_xy(x,y); center = HL_hexcenter(start); is_double(center.x, x * stride, EPS, "%d %d center X", x, y); is_double(center.y, 0.0, EPS, "%d %d center Y", x, y); x = 1; y = 1; start = HL_hex_xy(x,y); center = HL_hexcenter(start); is_double(center.x, x * stride, EPS, "%d %d center X", x, y); is_double(center.y, 0.5, EPS, "%d %d center Y", x, y); x = 2; y = 2; start = HL_hex_xy(x,y); center = HL_hexcenter(start); is_double(center.x, x * stride, EPS, "%d %d center X", x, y); is_double(center.y, 2.0, EPS, "%d %d center Y", x, y); return 0; }