Hexagon-In or Hexagon-Out?
JavaScript (ES6) 77 83

(a,b,l,h=Math.sqrt(3)*l,x=a&lt;0?-a:a,y=b&lt;0?-b:b)=&gt;y|x!=l?2*y&lt;h&amp;x/l+y/h&lt;1?1:-1:0


Test



f=(a,b,l,h=Math.sqrt(3)*l,x=a&lt;0?-a:a,y=b&lt;0?-b:b)=&gt;y|x!=l?2*y&lt;h&amp;x/l+y/h&lt;1?1:-1:0

// TEST

function go() {
  C.width=400;C.height=300;
  var l=+I.value, x,y, cols={0:'#ff0',1:'#0f0','-1':'#888'},
  ctx = C.getContext("2d")
  ctx.translate(200,150)
  ctx.strokeStyle='#000'
  ctx.lineWidth=1;
  ctx.beginPath();
  ctx.moveTo(0,-150);ctx.lineTo(0,150);ctx.moveTo(-200,0);ctx.lineTo(200,0);
  ctx.stroke();
  ctx.strokeStyle='#f00'
  ctx.beginPath();
  ctx.moveTo(l*10,0);ctx.lineTo(l*5,l*Math.sqrt(3)*5);ctx.lineTo(-l*5,l*Math.sqrt(3)*5)
  ctx.lineTo(-l*10,0);ctx.lineTo(-l*5,-l*Math.sqrt(3)*5);ctx.lineTo(l*5,-l*Math.sqrt(3)*5)
  ctx.closePath();
  ctx.stroke();

  for(y=-14;y&lt;15;y++)
    for(x=-19;x&lt;20;x++) {
      ctx.beginPath();
      ctx.moveTo(x*10,y*10-3);ctx.lineTo(x*10,y*10+3);
      ctx.moveTo(x*10-3,y*10);ctx.lineTo(x*10+3,y*10);
      ctx.strokeStyle=cols[f(x,y,l)]
      ctx.stroke()
    }
}

go()
#C {
  border: 1px solid #000
}
&lt;b&gt;L&lt;/b&gt; &lt;input id=I value=15&gt;&lt;button onclick="go()"&gt;GO&lt;/button&gt;&lt;br&gt;
&lt;canvas id=C width=400 height=300&gt;&lt;/canvas&gt;