New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

hexgrid

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexgrid

A hexagonal grid

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

hexgrid

A hexagonal grid layout. This prototype is flexible abstraction layer for hexagaonal grids.

npm install hexgrid --save

Uses axial/trapezoidal coordinate space with pointy-top hexagons

  • Increasing x goes right
  • Increasing y goes bottom right

Examples

// Init the hexgrid
var Hexgrid = require('hexgrid');
var grid = new Hexgrid({
  size: 20
});

// Add a hexagon cell
var firstCellPoint = new Point(1, 2);
var firstCell = new Hexcell(firstCellPoint);
grid.add(firstCell);

Methods

Hexgrid.add(hexcell)

Adds a cell to the grid

Hexgrid.remove(point2d)

Removes a grid cell at point2d

Hexgrid.get(point2d)

Gets a hexcell at point2d

Hexgrid.getXY(point2d)

Gets the calculated x and y (based on the hexagonal grid) of a point

Hexgrid.isEmpty(point2d)

Returns true if there is no hexcell at point2d

Hexgrid.getHexcells()

Returns an array of all hexcells

Keywords

hex

FAQs

Package last updated on 31 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts