generative-utils
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -6,9 +6,9 @@ function h(i, n) { | ||
function g(i, n) { | ||
const { x1: t, y1: o, x2: e, y2: u } = i, { x1: x, y1: y, x2: l, y2: r } = n; | ||
if (t === e && o === u || x === l && y === r) | ||
const { x1: t, y1: o, x2: e, y2: u } = i, { x1: x, y1: y, x2: r, y2: l } = n; | ||
if (t === e && o === u || x === r && y === l) | ||
return !1; | ||
const f = (r - y) * (e - t) - (l - x) * (u - o); | ||
const f = (l - y) * (e - t) - (r - x) * (u - o); | ||
if (f === 0) | ||
return !1; | ||
const s = ((l - x) * (o - y) - (r - y) * (t - x)) / f, a = ((e - t) * (o - y) - (u - o) * (t - x)) / f; | ||
const s = ((r - x) * (o - y) - (l - y) * (t - x)) / f, a = ((e - t) * (o - y) - (u - o) * (t - x)) / f; | ||
if (s < 0 || s > 1 || a < 0 || a > 1) | ||
@@ -54,3 +54,3 @@ return !1; | ||
} | ||
function p({ x1: i, y1: n, x2: t, y2: o }) { | ||
function b({ x1: i, y1: n, x2: t, y2: o }) { | ||
let e = t - i, u = o - n; | ||
@@ -74,15 +74,15 @@ const x = Math.sqrt(e * e + u * u); | ||
} | ||
function b(i = `${Math.random() * 1e8}`) { | ||
function p(i = `${Math.random() * 1e8}`) { | ||
const n = m(i), t = M(n()); | ||
return function(o = 0, e = 1, u = 0.01) { | ||
return function(o = 0, e = 1, u) { | ||
const x = t() * (e - o) + o; | ||
return Math.round(x / u) * u; | ||
return u ? Math.round(x / u) * u : x; | ||
}; | ||
} | ||
export { | ||
b as createRandom, | ||
p as createRandom, | ||
g as lineIntersect, | ||
p as lineNormal, | ||
b as lineNormal, | ||
w as lineRectIntersections, | ||
h as pointDist | ||
}; |
{ | ||
"name": "generative-utils", | ||
"private": false, | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
5566