Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ray-vs-rect

psalaets2MIT2.0.1

Ray-aware rectangle intersection check.

ray, rectangle, intersect, 2d

readme

ray-vs-rect

Ray-aware rectangle intersection check.

Usage

var rayVsRect = require('ray-vs-rect');

var ray = {
  start: {x: 10, y: 50},
  end: {x: 70, y: 50}
};

var rect = {
  left: 45,
  top: 45,
  width: 10,
  height: 10
};

var point = rayVsRect(ray, rect);

point // {x: 45, y: 50}

Install

npm install ray-vs-rect

License

MIT