title: Kineticjs find out if a line collisions with a rectangle shape
body: <p>I'm trying to write a function to detect if a line collsions with a rectangle shape.
  I have a function to detect if an image intersects with a rectangle but a line shape doesn't have all the properties I need like width and height etc.</p>
  
  <pre><code>function checkCollision(obj1, obj2){ //checks for collision
  var status = false;
  var obj1Top = obj1.getAttr('y');
  var obj1Bottom = obj1.getAttr('y') + obj1.getAttr('height');
  var obj1Left = obj1.getAttr('x');
  var obj1Right = obj1.getAttr('x') + obj1.getAttr('width');
  
  var obj2Top = obj2.getAttr('y');
  var obj2Bottom = obj2.getAttr('y') + obj2.getAttr('height');
  var obj2Left = obj2.getAttr('x');
  var obj2Right = obj2.getAttr('x') + obj2.getAttr('width');
  
  if (!(obj1Bottom &lt; obj2Top || obj1Top &gt; obj2Bottom || obj1Left &gt; obj2Right || obj1Right &lt; obj2Left))
  
  status = true;
  
  return status;
  }
  </code></pre>
  
  <p>Any Ideas?</p>