Skip to content

gtforge/HexGridSwift

 
 

Repository files navigation

HexGrid

Basics

Configurable hex grid on abstract surface.

Examples

import Morton
import HexGrid

let center = Point(x: 0.0, y: 0.0)
let size = Point(x: 20.0, y: 10.0)
let grid = Grid(orientation: OrientationFlat, origin: center, size: size, mort: try! Morton64(dimensions: 2, bits: 32))
let hex: Hex = grid.hexAt(Point(x: 50.0, y: 50.0))
let code: Int64 = try! grid.hexToCode(hex)
let restoredHex: Hex = grid.hexFromCode(code)
let neighbors: [Hex] = grid.hexNeighbors(hex, layers: 2)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 89.5%
  • Ruby 8.0%
  • Shell 2.5%