jeremyfromearth / hex

Hexagons for C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HEX

Hexagonal grids for C++

This library provides only hexagon related computations and is renderer agnostic. The examples below have been rendered using Cinder.

Creation, addition & subtraction

l = hex::layout::hexagonal(6);

demo 1

l -= hex::layout::hexagonal(3);

demo 2

l += hex::layout::parallelogram(10, 10, layout::options::vertical);

demo 3

l += hex::layout::parallelogram(10, 10, layout::options::standard);

demo 4

l -= hex::layout::hexagonal(3);

demo 5

l += hex::layout::hexagonal(1);

demo 6

Coordinate space conversions

vec2 v = vec2(e.getPos()) - getWindowCenter();
hex::point p(v.x, v.y);
hover = hex::lattice::point_to_cell(p, orientation, radius);

demo 7

References

Red Blob Games: http://www.redblobgames.com/grids/hexagons/

About

Hexagons for C++

License:GNU General Public License v3.0


Languages

Language:C++ 99.2%Language:Shell 0.8%