function Hex(hexX, hexY) {
  this.hexX = hexX;
  this.hexY = hexY;
  // <polygon points="100,60 134.6,80 134.6,120 100,140 65.3,120 65.3,80" class="grid"></polygon>
  var xy = hexToScreen(hexX, hexY);
  var element = document.createElementNS(SVG_NS, 'polygon');
  var points = [];
  points[0] = (xy.x) + ',' + (xy.y - HEX_HEIGHT / 2);
  points[1] = (xy.x + HEX_WIDTH / 2) + ',' + (xy.y - HEX_HEIGHT / 4);
  points[2] = (xy.x + HEX_WIDTH / 2) + ',' + (xy.y + HEX_HEIGHT / 4);
  points[3] = (xy.x) + ',' + (xy.y +  HEX_HEIGHT / 2);
  points[4] = (xy.x - HEX_WIDTH / 2) + ',' + (xy.y + HEX_HEIGHT / 4);
  points[5] = (xy.x - HEX_WIDTH / 2) + ',' + (xy.y - HEX_HEIGHT / 4);
  element.setAttribute('points', points.join(' '));
  element.setAttribute('class', 'grid');
  var g = document.getElementById('grid');
  g.appendChild(element);

  this.element = element;
  this.isWall = false;
}
// Constructor for a single hexagon centered on the given coordinates.
Constructor for a single hexagon centered on the given coordinates.
Constructor for a single hexagon centered on the given coordinates .
function Hex(hexX, hexY) {
  this.hexX = hexX;
  this.hexY = hexY;
  var xy = hexToScreen(hexX, hexY);
  var element = document.createElementNS(SVG_NS, 'polygon');
  var points = [];
  points[0] = (xy.x) + ',' + (xy.y - HEX_HEIGHT / 2);
  points[1] = (xy.x + HEX_WIDTH / 2) + ',' + (xy.y - HEX_HEIGHT / 4);
  points[2] = (xy.x + HEX_WIDTH / 2) + ',' + (xy.y + HEX_HEIGHT / 4);
  points[3] = (xy.x) + ',' + (xy.y +  HEX_HEIGHT / 2);
  points[4] = (xy.x - HEX_WIDTH / 2) + ',' + (xy.y + HEX_HEIGHT / 4);
  points[5] = (xy.x - HEX_WIDTH / 2) + ',' + (xy.y - HEX_HEIGHT / 4);
  element.setAttribute('points', points.join(' '));
  element.setAttribute('class', 'grid');
  var g = document.getElementById('grid');
  g.appendChild(element);
  this.element = element;
  this.isWall = false;
}
function Hex ( hexX , hexY ) { this . hexX = hexX ; this . hexY = hexY ; var xy = hexToScreen ( hexX , hexY ) ; var element = document . createElementNS ( SVG_NS , 'polygon' ) ; var points = [ ] ; points [ 0 ] = ( xy . x ) + ',' + ( xy . y - HEX_HEIGHT / 2 ) ; points [ 1 ] = ( xy . x + HEX_WIDTH / 2 ) + ',' + ( xy . y - HEX_HEIGHT / 4 ) ; points [ 2 ] = ( xy . x + HEX_WIDTH / 2 ) + ',' + ( xy . y + HEX_HEIGHT / 4 ) ; points [ 3 ] = ( xy . x ) + ',' + ( xy . y + HEX_HEIGHT / 2 ) ; points [ 4 ] = ( xy . x - HEX_WIDTH / 2 ) + ',' + ( xy . y + HEX_HEIGHT / 4 ) ; points [ 5 ] = ( xy . x - HEX_WIDTH / 2 ) + ',' + ( xy . y - HEX_HEIGHT / 4 ) ; element . setAttribute ( 'points' , points . join ( ' ' ) ) ; element . setAttribute ( 'class' , 'grid' ) ; var g = document . getElementById ( 'grid' ) ; g . appendChild ( element ) ; this . element = element ; this . isWall = false ; }
Constructor for a single hexagon centered on the given coordinates.
Constructor for a single hexagon centered on the given coordinates .
// <polygon points="100,60 134.6,80 134.6,120 100,140 65.3,120 65.3,80" class="grid"></polygon>