do-line-segments-cross

1.0.0 • Public • Published

do-line-segments-cross

A Node.js package that calculates if two given line segments (passed as four points) cross each other.

doLineSegmentsCross(p1, q1, p2, q2) where each parameter should have x and y properties properly set.

p1 & q1 are the coordinates that define the first line, and p2 & q2 are the coordinates that define the second line.

Usage

First, install the package using npm:

npm install do-line-segments-cross --save

Then, require the package and use it like so:

var doLineSegmentsCross = require('do-line-segments-cross');

console.log({x: 1, y: 1}, {x: 6, y: 6}, {x: 6, y: 6}, {x: 1, y: 1});    // true
console.log({x: 1, y: 1}, {x: 6, y: 6}, {x: 2, y: 1}, {x: 7, y: 6});    // false

License

MIT

/do-line-segments-cross/

    Package Sidebar

    Install

    npm i do-line-segments-cross

    Weekly Downloads

    0

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    4.54 kB

    Total Files

    5

    Last publish

    Collaborators

    • jeevandark