Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

exact-segment-intersect

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exact-segment-intersect - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

15

intersect.js

@@ -9,2 +9,3 @@ "use strict"

var compress = require("robust-compress")
var robustIntersect = require("robust-segment-intersect")

@@ -22,2 +23,7 @@ // Find solution to system of two linear equations

function exactIntersect(a, b, c, d) {
if(!robustIntersect(a, b, c, d)) {
return [ [0], [0], [0] ]
}
var x1 = robustSum([c[1]], [-d[1]])

@@ -33,7 +39,2 @@ var y1 = robustSum([-c[0]], [d[0]])

//Check denominator
if(denom[0] === 0) {
return [ [0], [0], [0] ]
}
var w0 = robustSum(twoProduct(-a[0], b[1]), twoProduct(a[1], b[0]))

@@ -58,4 +59,4 @@ var w1 = robustSum(twoProduct(-c[0], d[1]), twoProduct(c[1], d[0]))

robustScale(w0, d[1])))
return [ compress(nX), compress(nY), compress(denom) ]
}
}
{
"name": "exact-segment-intersect",
"version": "1.0.0",
"version": "2.0.0",
"description": "Exactly constructs the intersection of two line segments",

@@ -12,4 +12,5 @@ "main": "intersect.js",

"robust-scale": "^1.0.2",
"two-product": "^1.0.2",
"robust-sum": "^1.0.0"
"robust-segment-intersect": "^1.0.1",
"robust-sum": "^1.0.0",
"two-product": "^1.0.2"
},

@@ -16,0 +17,0 @@ "devDependencies": {

@@ -1,2 +0,2 @@

exact-segment-intersection
exact-segment-intersect
==========================

@@ -12,3 +12,3 @@ Exactly computes the intersection of a pair of line segments as a homogeneous vector of non-overlapping increasing sequences.

```javascript
var exactIntersect = require("exact-segment-intersection")
var exactIntersect = require("exact-segment-intersect")

@@ -32,3 +32,3 @@ var a = [-1,0]

```
npm install exact-segment-intersection
npm install exact-segment-intersect
```

@@ -38,3 +38,3 @@

#### `require("exact-segment-intersection")(a,b,c,d)`
#### `require("exact-segment-intersect")(a,b,c,d)`
Exactly computes the intersection of the line segments `[a,b]` and `[c,d]`

@@ -48,2 +48,2 @@

# Credits
(c) 2014 Mikola Lysenko. MIT License
(c) 2014 Mikola Lysenko. MIT License

@@ -39,3 +39,3 @@ "use strict"

t.ok(validate(s), "validate s")
t.equals(robustCompare(s, [0]), 0, "check point on line")

@@ -56,3 +56,3 @@ }

var y = computeIntersection(
p[h][s], p[h][s^1],
p[h][s], p[h][s^1],
p[h^1][r], p[h^1][r^1])

@@ -79,2 +79,11 @@ t.ok(validate(y[0]), "validate x")

t.end()
})
})
tape('no isect', function(t) {
var isect = computeIntersection([-1, 10], [-10, 1], [10, 0], [10, 10]);
t.equal(isect[2][0], 0, 'no intersections')
t.end();
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc