0.0.3 • Published 3 years ago

line-intersect-2d v0.0.3

Weekly downloads
3
License
ISC
Repository
github
Last release
3 years ago

line-intersect-2d

A simple library to get intersection of 2 dimensional lines

Installation

$ npm install --save line-intersect-2d

Usage

var lineIntersect = require("line-intersect-2d");

var p1 = [0,0];
var p2 = [0.5,0];
var p3 = [1,0.5];
var p4 = [1,1];
var tol = 0.000006; // The tolerance to check for equality. It is 0.000005 by default
var allowExtend = false; // Treat it as a line segment
var b = lineIntersect.intersect(p1,p2,p3,p4, tol, allowExtend); // b = null, since allow extend is false.

var allowExtend = true; // Treat it as an infinite line
var b = lineIntersect.intersect(p1,p2,p3,p4, tol, allowExtend); // b = [1,0], since allow extend is true.
0.0.3

3 years ago

0.0.2

7 years ago

0.0.1

7 years ago