curvy 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ import { solve as solve$4 } from './linear2d.mjs';
9
9
  import { length as length$2, fromPolynomials as fromPolynomials$2, solve as solve$3, derivative as derivative$1 } from './quadratic2d.mjs';
10
10
  import '../shared/curvy.BzVmUIKm.mjs';
11
11
  import '../shared/curvy.BDhiZ7He.mjs';
12
- import '../shared/curvy.48SmIWxE.mjs';
12
+ import '../shared/curvy.BZ_mTkJe.mjs';
13
13
  import '../polynomial/linear.mjs';
14
14
 
15
15
  const CubicCurve2dTypeId = Symbol("curvy/curve/cubic2d");
@@ -4,7 +4,7 @@ import { round } from '../utils.mjs';
4
4
  import { make as make$1 } from '../vector/vector2.mjs';
5
5
  import '../shared/curvy.BDhiZ7He.mjs';
6
6
  import '../interval.mjs';
7
- import '../shared/curvy.48SmIWxE.mjs';
7
+ import '../shared/curvy.BZ_mTkJe.mjs';
8
8
 
9
9
  const LinearCurve2dTypeId = Symbol("curvy/curve/linear2d");
10
10
  class LinearCurve2dImpl extends Pipeable {
@@ -8,7 +8,7 @@ import { make as make$1, magnitude, cross } from '../vector/vector2.mjs';
8
8
  import { fromPolynomials as fromPolynomials$2, length as length$2, solve as solve$3, derivative as derivative$3 } from './linear2d.mjs';
9
9
  import '../shared/curvy.BDhiZ7He.mjs';
10
10
  import '../shared/curvy.BzVmUIKm.mjs';
11
- import '../shared/curvy.48SmIWxE.mjs';
11
+ import '../shared/curvy.BZ_mTkJe.mjs';
12
12
 
13
13
  const QuadraticCurve2dTypeId = Symbol(
14
14
  "curvy/curve/quadratic2d"
@@ -1,7 +1,7 @@
1
- import { i as isMatrix2x2$1, m as make, f as fromRows$1, a as fromColumns$1, s as setRow$1, b as setColumn$1, d as determinant$1, v as vectorProductLeft$1, c as vectorProductRight$1, e as solveSystem$1, t as toRows$1, g as toColumns$1, r as rowVector$1, h as columnVector$1, j as transpose$1, k as reverseRows$1, l as reverseColumns$1 } from '../shared/curvy.Ct6KbNL5.mjs';
1
+ import { i as isMatrix2x2$1, m as make, f as fromRows$1, a as fromColumns$1, s as setRow$1, b as setColumn$1, d as determinant$1, v as vectorProductLeft$1, c as vectorProductRight$1, e as solveSystem$1, t as toRows$1, g as toColumns$1, r as rowVector$1, h as columnVector$1, j as transpose$1, k as reverseRows$1, l as reverseColumns$1 } from '../shared/curvy.Cps2R_RU.mjs';
2
2
  import '../utils.mjs';
3
3
  import '../pipe.mjs';
4
- import '../shared/curvy.48SmIWxE.mjs';
4
+ import '../shared/curvy.BZ_mTkJe.mjs';
5
5
 
6
6
  const isMatrix2x2 = isMatrix2x2$1;
7
7
  const matrix2x2 = make;
@@ -1,9 +1,9 @@
1
- import { i as isMatrix3x3$1, m as make, f as fromRows$1, a as fromColumns$1, s as setRow$1, b as setColumn$1, d as determinant$1, c as minor$1, v as vectorProductLeft$1, e as vectorProductRight$1, g as solveSystem$1, t as toRows$1, h as toColumns$1, r as rowVector$1, j as columnVector$1, k as transpose$1, l as reverseRows$1, n as reverseColumns$1 } from '../shared/curvy.CREzSbNe.mjs';
2
- import '../shared/curvy.Ct6KbNL5.mjs';
1
+ import { i as isMatrix3x3$1, m as make, f as fromRows$1, a as fromColumns$1, s as setRow$1, b as setColumn$1, d as determinant$1, c as minor$1, v as vectorProductLeft$1, e as vectorProductRight$1, g as solveSystem$1, t as toRows$1, h as toColumns$1, r as rowVector$1, j as columnVector$1, k as transpose$1, l as reverseRows$1, n as reverseColumns$1 } from '../shared/curvy.Cnu_4-XZ.mjs';
2
+ import '../shared/curvy.Cps2R_RU.mjs';
3
3
  import '../utils.mjs';
4
4
  import '../pipe.mjs';
5
- import '../shared/curvy.48SmIWxE.mjs';
6
- import '../shared/curvy.Wcdc9gLh.mjs';
5
+ import '../shared/curvy.BZ_mTkJe.mjs';
6
+ import '../shared/curvy.D4MAcMgx.mjs';
7
7
 
8
8
  const isMatrix3x3 = isMatrix3x3$1;
9
9
  const matrix3x3 = make;
@@ -1,10 +1,10 @@
1
- import { n as toFourDimensionalIndex } from '../shared/curvy.Ct6KbNL5.mjs';
1
+ import { n as toFourDimensionalIndex } from '../shared/curvy.Cps2R_RU.mjs';
2
2
  import { dual, Pipeable } from '../pipe.mjs';
3
3
  import { round, invariant } from '../utils.mjs';
4
4
  import { c as components, m as make$3, d as dot } from '../shared/curvy.C2XGH0R0.mjs';
5
- import { d as determinant$2, m as make$2 } from '../shared/curvy.CREzSbNe.mjs';
6
- import '../shared/curvy.48SmIWxE.mjs';
7
- import '../shared/curvy.Wcdc9gLh.mjs';
5
+ import { d as determinant$2, m as make$2 } from '../shared/curvy.Cnu_4-XZ.mjs';
6
+ import '../shared/curvy.BZ_mTkJe.mjs';
7
+ import '../shared/curvy.D4MAcMgx.mjs';
8
8
 
9
9
  const Matrix4x4TypeId = Symbol.for("curvy/matrix4x4");
10
10
  class Matrix4x4Impl extends Pipeable {
@@ -8,7 +8,7 @@ import '../shared/curvy.BzVmUIKm.mjs';
8
8
  import '../shared/curvy.BDhiZ7He.mjs';
9
9
  import '../polynomial/quadratic.mjs';
10
10
  import '../vector/vector2.mjs';
11
- import '../shared/curvy.48SmIWxE.mjs';
11
+ import '../shared/curvy.BZ_mTkJe.mjs';
12
12
  import '../curve/linear2d.mjs';
13
13
  import '../polynomial/linear.mjs';
14
14
  import '../curve/quadratic2d.mjs';
@@ -5,7 +5,7 @@ import { round } from '../utils.mjs';
5
5
  import '../polynomial/linear.mjs';
6
6
  import '../shared/curvy.BDhiZ7He.mjs';
7
7
  import '../vector/vector2.mjs';
8
- import '../shared/curvy.48SmIWxE.mjs';
8
+ import '../shared/curvy.BZ_mTkJe.mjs';
9
9
 
10
10
  const LinearPath2dTypeId = Symbol("curvy/path/linear2d");
11
11
  class LinearPath2dImpl extends Pipeable {
@@ -8,7 +8,7 @@ import '../shared/curvy.BDhiZ7He.mjs';
8
8
  import '../polynomial/quadratic.mjs';
9
9
  import '../shared/curvy.BzVmUIKm.mjs';
10
10
  import '../vector/vector2.mjs';
11
- import '../shared/curvy.48SmIWxE.mjs';
11
+ import '../shared/curvy.BZ_mTkJe.mjs';
12
12
  import '../curve/linear2d.mjs';
13
13
 
14
14
  const QuadraticPath2dTypeId = Symbol(
@@ -26,6 +26,7 @@ class Vector2Impl extends Pipeable {
26
26
  }
27
27
  const isVector2 = (v) => typeof v === "object" && v !== null && Vector2TypeId in v;
28
28
  const make = (v0, v1 = v0) => new Vector2Impl(v0, v1);
29
+ const fromPolar = (r, theta) => make(r * Math.cos(theta), r * Math.sin(theta));
29
30
  const components = (v) => [v.x, v.y];
30
31
  const magnitude = (vector) => round(Math.hypot(vector.x, vector.y));
31
32
  const normalize = (vector) => {
@@ -56,4 +57,4 @@ const setTheta = dual(2, (v, theta) => {
56
57
  return make(r * Math.cos(theta), r * Math.sin(theta));
57
58
  });
58
59
 
59
- export { magnitude as a, components as b, cross as c, dot as d, add as e, subtract as f, scale as g, hadamard as h, isVector2 as i, getX as j, setX as k, getY as l, make as m, normalize as n, setY as o, setR as p, getTheta as q, setTheta as r, softmax as s };
60
+ export { magnitude as a, components as b, cross as c, dot as d, add as e, fromPolar as f, subtract as g, hadamard as h, isVector2 as i, scale as j, getX as k, setX as l, make as m, normalize as n, getY as o, setY as p, setR as q, getTheta as r, softmax as s, setTheta as t };
@@ -1,7 +1,7 @@
1
- import { o as toThreeDimensionalIndex, d as determinant$1, m as make$1 } from './curvy.Ct6KbNL5.mjs';
1
+ import { o as toThreeDimensionalIndex, d as determinant$1, m as make$1 } from './curvy.Cps2R_RU.mjs';
2
2
  import { dual, Pipeable } from '../pipe.mjs';
3
3
  import { round, invariant } from '../utils.mjs';
4
- import { c as components, m as make$2, d as dot } from './curvy.Wcdc9gLh.mjs';
4
+ import { c as components, m as make$2, d as dot } from './curvy.D4MAcMgx.mjs';
5
5
 
6
6
  const Matrix3x3TypeId = Symbol.for("curvy/matrix3x3");
7
7
  class Matrix3x3Impl extends Pipeable {
@@ -1,6 +1,6 @@
1
1
  import { invariant, round } from '../utils.mjs';
2
2
  import { dual, Pipeable } from '../pipe.mjs';
3
- import { m as make$1, d as dot } from './curvy.48SmIWxE.mjs';
3
+ import { m as make$1, d as dot } from './curvy.BZ_mTkJe.mjs';
4
4
 
5
5
  function toIndex(input) {
6
6
  if (typeof input === "number") {
@@ -3,11 +3,11 @@ import { fromCurves } from '../path/cubic2d.mjs';
3
3
  import { dual, Pipeable } from '../pipe.mjs';
4
4
  import { roundDown, invariant } from '../utils.mjs';
5
5
  import { t as toCurves, f as fromSpline } from '../shared/curvy.CE4X6_Is.mjs';
6
- import '../shared/curvy.Ct6KbNL5.mjs';
7
- import '../shared/curvy.48SmIWxE.mjs';
6
+ import '../shared/curvy.Cps2R_RU.mjs';
7
+ import '../shared/curvy.BZ_mTkJe.mjs';
8
8
  import '../shared/curvy.C2XGH0R0.mjs';
9
- import '../shared/curvy.CREzSbNe.mjs';
10
- import '../shared/curvy.Wcdc9gLh.mjs';
9
+ import '../shared/curvy.Cnu_4-XZ.mjs';
10
+ import '../shared/curvy.D4MAcMgx.mjs';
11
11
  import '../curve/cubic2d.mjs';
12
12
  import '../interval.mjs';
13
13
  import '../shared/curvy.DmVFTi0N.mjs';
@@ -1,12 +1,12 @@
1
1
  export { b as append, h as appendAccelerationAligned, e as appendCurvatureMirrored, d as appendTangentAligned, g as appendVelocityAligned, c as characteristic, a as fromArray, f as fromSpline, i as isCubicBezier2d, m as make, j as toPath } from '../shared/curvy.CE4X6_Is.mjs';
2
2
  import '../matrix/matrix4x4.mjs';
3
- import '../shared/curvy.Ct6KbNL5.mjs';
3
+ import '../shared/curvy.Cps2R_RU.mjs';
4
4
  import '../utils.mjs';
5
5
  import '../pipe.mjs';
6
- import '../shared/curvy.48SmIWxE.mjs';
6
+ import '../shared/curvy.BZ_mTkJe.mjs';
7
7
  import '../shared/curvy.C2XGH0R0.mjs';
8
- import '../shared/curvy.CREzSbNe.mjs';
9
- import '../shared/curvy.Wcdc9gLh.mjs';
8
+ import '../shared/curvy.Cnu_4-XZ.mjs';
9
+ import '../shared/curvy.D4MAcMgx.mjs';
10
10
  import '../path/cubic2d.mjs';
11
11
  import '../curve/cubic2d.mjs';
12
12
  import '../interval.mjs';
@@ -4,11 +4,11 @@ import { dual, Pipeable } from '../pipe.mjs';
4
4
  import { invariant } from '../utils.mjs';
5
5
  import { subtract, scale, add } from '../vector/vector2.mjs';
6
6
  import { t as toCurves, f as fromSpline } from '../shared/curvy.CE4X6_Is.mjs';
7
- import '../shared/curvy.Ct6KbNL5.mjs';
8
- import '../shared/curvy.48SmIWxE.mjs';
7
+ import '../shared/curvy.Cps2R_RU.mjs';
8
+ import '../shared/curvy.BZ_mTkJe.mjs';
9
9
  import '../shared/curvy.C2XGH0R0.mjs';
10
- import '../shared/curvy.CREzSbNe.mjs';
11
- import '../shared/curvy.Wcdc9gLh.mjs';
10
+ import '../shared/curvy.Cnu_4-XZ.mjs';
11
+ import '../shared/curvy.D4MAcMgx.mjs';
12
12
  import '../curve/cubic2d.mjs';
13
13
  import '../interval.mjs';
14
14
  import '../shared/curvy.DmVFTi0N.mjs';
@@ -3,11 +3,11 @@ import { fromCurves } from '../path/cubic2d.mjs';
3
3
  import { dual, Pipeable } from '../pipe.mjs';
4
4
  import { invariant } from '../utils.mjs';
5
5
  import { t as toCurves, f as fromSpline } from '../shared/curvy.CE4X6_Is.mjs';
6
- import '../shared/curvy.Ct6KbNL5.mjs';
7
- import '../shared/curvy.48SmIWxE.mjs';
6
+ import '../shared/curvy.Cps2R_RU.mjs';
7
+ import '../shared/curvy.BZ_mTkJe.mjs';
8
8
  import '../shared/curvy.C2XGH0R0.mjs';
9
- import '../shared/curvy.CREzSbNe.mjs';
10
- import '../shared/curvy.Wcdc9gLh.mjs';
9
+ import '../shared/curvy.Cnu_4-XZ.mjs';
10
+ import '../shared/curvy.D4MAcMgx.mjs';
11
11
  import '../curve/cubic2d.mjs';
12
12
  import '../interval.mjs';
13
13
  import '../shared/curvy.DmVFTi0N.mjs';
@@ -12,6 +12,7 @@ declare const make: {
12
12
  (xy: number): Vector2;
13
13
  (x: number, y: number): Vector2;
14
14
  };
15
+ declare const fromPolar: (r: number, theta: number) => Vector2;
15
16
  declare const magnitude: (vector: Vector2) => number;
16
17
  declare const normalize: (vector: Vector2) => Vector2;
17
18
  declare const dot: {
@@ -62,4 +63,4 @@ declare const setTheta: {
62
63
  (theta: number): (v: Vector2) => Vector2;
63
64
  };
64
65
 
65
- export { type Vector2, add, components, cross, dot, getR, getTheta, getX, getY, hadamard, isVector2, magnitude, make, normalize, scale, setR, setTheta, setX, setY, softmax, subtract, zero };
66
+ export { type Vector2, add, components, cross, dot, fromPolar, getR, getTheta, getX, getY, hadamard, isVector2, magnitude, make, normalize, scale, setR, setTheta, setX, setY, softmax, subtract, zero };
@@ -12,6 +12,7 @@ declare const make: {
12
12
  (xy: number): Vector2;
13
13
  (x: number, y: number): Vector2;
14
14
  };
15
+ declare const fromPolar: (r: number, theta: number) => Vector2;
15
16
  declare const magnitude: (vector: Vector2) => number;
16
17
  declare const normalize: (vector: Vector2) => Vector2;
17
18
  declare const dot: {
@@ -62,4 +63,4 @@ declare const setTheta: {
62
63
  (theta: number): (v: Vector2) => Vector2;
63
64
  };
64
65
 
65
- export { type Vector2, add, components, cross, dot, getR, getTheta, getX, getY, hadamard, isVector2, magnitude, make, normalize, scale, setR, setTheta, setX, setY, softmax, subtract, zero };
66
+ export { type Vector2, add, components, cross, dot, fromPolar, getR, getTheta, getX, getY, hadamard, isVector2, magnitude, make, normalize, scale, setR, setTheta, setX, setY, softmax, subtract, zero };
@@ -1,9 +1,10 @@
1
- import { i as isVector2$1, m as make$1, a as magnitude$1, n as normalize$1, d as dot$1, c as cross$1, b as components$1, s as softmax$1, e as add$1, f as subtract$1, h as hadamard$1, g as scale$1, j as getX$1, k as setX$1, l as getY$1, o as setY$1, p as setR$1, q as getTheta$1, r as setTheta$1 } from '../shared/curvy.48SmIWxE.mjs';
1
+ import { i as isVector2$1, m as make$1, f as fromPolar$1, a as magnitude$1, n as normalize$1, d as dot$1, c as cross$1, b as components$1, s as softmax$1, e as add$1, g as subtract$1, h as hadamard$1, j as scale$1, k as getX$1, l as setX$1, o as getY$1, p as setY$1, q as setR$1, r as getTheta$1, t as setTheta$1 } from '../shared/curvy.BZ_mTkJe.mjs';
2
2
  import '../pipe.mjs';
3
3
  import '../utils.mjs';
4
4
 
5
5
  const isVector2 = isVector2$1;
6
6
  const make = make$1;
7
+ const fromPolar = fromPolar$1;
7
8
  const magnitude = magnitude$1;
8
9
  const normalize = normalize$1;
9
10
  const dot = dot$1;
@@ -24,4 +25,4 @@ const setR = setR$1;
24
25
  const getTheta = getTheta$1;
25
26
  const setTheta = setTheta$1;
26
27
 
27
- export { add, components, cross, dot, getR, getTheta, getX, getY, hadamard, isVector2, magnitude, make, normalize, scale, setR, setTheta, setX, setY, softmax, subtract, zero };
28
+ export { add, components, cross, dot, fromPolar, getR, getTheta, getX, getY, hadamard, isVector2, magnitude, make, normalize, scale, setR, setTheta, setX, setY, softmax, subtract, zero };
@@ -1,4 +1,4 @@
1
- import { i as isVector3$1, m as make$1, a as magnitude$1, n as normalize$1, d as dot$1, c as components$1, s as softmax$1, b as add$1, e as subtract$1, h as hadamard$1, f as scale$1, g as getX$1, j as setX$1, k as getY$1, l as setY$1, o as getZ$1, p as setZ$1, q as setR$1, r as getTheta$1, t as setTheta$1, u as getPhi$1, v as setPhi$1 } from '../shared/curvy.Wcdc9gLh.mjs';
1
+ import { i as isVector3$1, m as make$1, a as magnitude$1, n as normalize$1, d as dot$1, c as components$1, s as softmax$1, b as add$1, e as subtract$1, h as hadamard$1, f as scale$1, g as getX$1, j as setX$1, k as getY$1, l as setY$1, o as getZ$1, p as setZ$1, q as setR$1, r as getTheta$1, t as setTheta$1, u as getPhi$1, v as setPhi$1 } from '../shared/curvy.D4MAcMgx.mjs';
2
2
  import '../pipe.mjs';
3
3
  import '../utils.mjs';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "curvy",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Spline and Curve utilities",
5
5
  "author": "Tim Morris <timthewebguy@gmail.com>",
6
6
  "homepage": "https://github.com/tkofh/curvy#readme",
@@ -30,6 +30,7 @@ class Vector3Impl extends Pipeable {
30
30
  }
31
31
  }
32
32
  const isVector3 = (v) => typeof v === "object" && v !== null && Vector3TypeId in v;
33
+ const make = (v0, v1 = v0, v2 = v1) => new Vector3Impl(v0, v1, v2);
33
34
  const magnitude = (vector) => round(Math.hypot(vector.x, vector.y, vector.z));
34
35
  const normalize = (vector) => {
35
36
  const m = magnitude(vector);
@@ -45,7 +46,6 @@ const softmax = (v) => {
45
46
  const sum = v0 + v1 + v2;
46
47
  return make(v0 / sum, v1 / sum, v2 / sum);
47
48
  };
48
- const make = (v0, v1 = v0, v2 = v1) => new Vector3Impl(v0, v1, v2);
49
49
  const add = dual(2, (a, b) => make(a.x + b.x, a.y + b.y, a.z + b.z));
50
50
  const subtract = dual(2, (a, b) => make(a.x - b.x, a.y - b.y, a.z - b.z));
51
51
  const hadamard = dual(2, (a, b) => make(a.x * b.x, a.y * b.y, a.z * b.z));