curvy 1.0.7 → 1.0.8

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.
@@ -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.NLeFCr-9.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.Cv-wIzDr.mjs';
2
2
  import '../shared/curvy.Cps2R_RU.mjs';
3
3
  import '../utils.mjs';
4
4
  import '../pipe.mjs';
5
5
  import '../shared/curvy.BZ_mTkJe.mjs';
6
- import '../shared/curvy.Ck0of1PI.mjs';
6
+ import '../shared/curvy.wYJQhFW-.mjs';
7
7
 
8
8
  const isMatrix3x3 = isMatrix3x3$1;
9
9
  const matrix3x3 = make;
@@ -2,9 +2,9 @@ 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.NLeFCr-9.mjs';
5
+ import { d as determinant$2, m as make$2 } from '../shared/curvy.Cv-wIzDr.mjs';
6
6
  import '../shared/curvy.BZ_mTkJe.mjs';
7
- import '../shared/curvy.Ck0of1PI.mjs';
7
+ import '../shared/curvy.wYJQhFW-.mjs';
8
8
 
9
9
  const Matrix4x4TypeId = Symbol.for("curvy/matrix4x4");
10
10
  class Matrix4x4Impl extends Pipeable {
@@ -1,7 +1,7 @@
1
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.Ck0of1PI.mjs';
4
+ import { b as components, m as make$2, d as dot } from './curvy.wYJQhFW-.mjs';
5
5
 
6
6
  const Matrix3x3TypeId = Symbol.for("curvy/matrix3x3");
7
7
  class Matrix3x3Impl extends Pipeable {
@@ -42,6 +42,12 @@ const normalize = (vector) => {
42
42
  return make(vector.x / m, vector.y / m, vector.z / m);
43
43
  };
44
44
  const dot = dual(2, (a, b) => round(a.x * b.x + a.y * b.y + a.z * b.z));
45
+ const cross = dual(2, (a, b) => {
46
+ const x = a.y * b.z - a.z * b.y;
47
+ const y = a.z * b.x - a.x * b.z;
48
+ const z = a.x * b.y - a.y * b.x;
49
+ return make(x, y, z);
50
+ });
45
51
  const components = (v) => [v.x, v.y, v.z];
46
52
  const softmax = (v) => {
47
53
  const max = Math.max(v.x, v.y, v.z);
@@ -62,20 +68,20 @@ const setY = dual(2, (v, y) => make(v.x, y, v.z));
62
68
  const getZ = (v) => v.z;
63
69
  const setZ = dual(2, (v, z) => make(v.x, v.y, z));
64
70
  const setR = dual(2, (v, r) => scale(r / magnitude(v))(v));
65
- const getPhi = (v) => Math.acos(v.z / magnitude(v));
66
- const setPhi = dual(2, (v, phi) => {
71
+ const getTheta = (v) => Math.acos(v.z / magnitude(v));
72
+ const setTheta = dual(2, (v, phi) => {
67
73
  const m = magnitude(v);
68
- const sinPhi = Math.sin(phi);
74
+ const sinTheta = Math.sin(phi);
69
75
  return make(
70
- m * sinPhi * Math.cos(v.y),
71
- m * sinPhi * Math.sin(v.y),
76
+ m * sinTheta * Math.cos(v.y),
77
+ m * sinTheta * Math.sin(v.y),
72
78
  m * Math.cos(phi)
73
79
  );
74
80
  });
75
- const getTheta = (v) => round(Math.atan2(v.y, v.x));
76
- const setTheta = dual(2, (v, theta) => {
81
+ const getPhi = (v) => round(Math.atan2(v.y, v.x));
82
+ const setPhi = dual(2, (v, theta) => {
77
83
  const m = magnitude(v);
78
84
  return make(m * Math.cos(theta), m * Math.sin(theta), v.z);
79
85
  });
80
86
 
81
- export { magnitude as a, add as b, components as c, dot as d, subtract as e, fromSpherical as f, scale as g, hadamard as h, isVector3 as i, getX as j, setX as k, getY as l, make as m, normalize as n, setY as o, getZ as p, setZ as q, setR as r, softmax as s, getTheta as t, setTheta as u, getPhi as v, setPhi as w };
87
+ export { magnitude as a, components as b, cross as c, dot as d, add as e, fromSpherical as f, subtract as g, hadamard as h, isVector3 as i, scale as j, getX as k, setX as l, make as m, normalize as n, getY as o, setY as p, getZ as q, setZ as r, softmax as s, setR as t, getTheta as u, setTheta as v, getPhi as w, setPhi as x };
@@ -6,8 +6,8 @@ import { t as toCurves, f as fromSpline } from '../shared/curvy.CE4X6_Is.mjs';
6
6
  import '../shared/curvy.Cps2R_RU.mjs';
7
7
  import '../shared/curvy.BZ_mTkJe.mjs';
8
8
  import '../shared/curvy.C2XGH0R0.mjs';
9
- import '../shared/curvy.NLeFCr-9.mjs';
10
- import '../shared/curvy.Ck0of1PI.mjs';
9
+ import '../shared/curvy.Cv-wIzDr.mjs';
10
+ import '../shared/curvy.wYJQhFW-.mjs';
11
11
  import '../curve/cubic2d.mjs';
12
12
  import '../interval.mjs';
13
13
  import '../shared/curvy.DmVFTi0N.mjs';
@@ -5,8 +5,8 @@ import '../utils.mjs';
5
5
  import '../pipe.mjs';
6
6
  import '../shared/curvy.BZ_mTkJe.mjs';
7
7
  import '../shared/curvy.C2XGH0R0.mjs';
8
- import '../shared/curvy.NLeFCr-9.mjs';
9
- import '../shared/curvy.Ck0of1PI.mjs';
8
+ import '../shared/curvy.Cv-wIzDr.mjs';
9
+ import '../shared/curvy.wYJQhFW-.mjs';
10
10
  import '../path/cubic2d.mjs';
11
11
  import '../curve/cubic2d.mjs';
12
12
  import '../interval.mjs';
@@ -7,8 +7,8 @@ import { t as toCurves, f as fromSpline } from '../shared/curvy.CE4X6_Is.mjs';
7
7
  import '../shared/curvy.Cps2R_RU.mjs';
8
8
  import '../shared/curvy.BZ_mTkJe.mjs';
9
9
  import '../shared/curvy.C2XGH0R0.mjs';
10
- import '../shared/curvy.NLeFCr-9.mjs';
11
- import '../shared/curvy.Ck0of1PI.mjs';
10
+ import '../shared/curvy.Cv-wIzDr.mjs';
11
+ import '../shared/curvy.wYJQhFW-.mjs';
12
12
  import '../curve/cubic2d.mjs';
13
13
  import '../interval.mjs';
14
14
  import '../shared/curvy.DmVFTi0N.mjs';
@@ -6,8 +6,8 @@ import { t as toCurves, f as fromSpline } from '../shared/curvy.CE4X6_Is.mjs';
6
6
  import '../shared/curvy.Cps2R_RU.mjs';
7
7
  import '../shared/curvy.BZ_mTkJe.mjs';
8
8
  import '../shared/curvy.C2XGH0R0.mjs';
9
- import '../shared/curvy.NLeFCr-9.mjs';
10
- import '../shared/curvy.Ck0of1PI.mjs';
9
+ import '../shared/curvy.Cv-wIzDr.mjs';
10
+ import '../shared/curvy.wYJQhFW-.mjs';
11
11
  import '../curve/cubic2d.mjs';
12
12
  import '../interval.mjs';
13
13
  import '../shared/curvy.DmVFTi0N.mjs';
@@ -20,6 +20,10 @@ declare const dot: {
20
20
  (a: Vector3, b: Vector3): number;
21
21
  (b: Vector3): (a: Vector3) => number;
22
22
  };
23
+ declare const cross: {
24
+ (a: Vector3, b: Vector3): Vector3;
25
+ (b: Vector3): (a: Vector3) => Vector3;
26
+ };
23
27
  declare const components: (v: Vector3) => [number, number, number];
24
28
  declare const softmax: (v: Vector3) => Vector3;
25
29
  declare const zero: Vector3;
@@ -70,4 +74,4 @@ declare const setPhi: {
70
74
  (phi: number): (v: Vector3) => Vector3;
71
75
  };
72
76
 
73
- export { type Vector3, add, components, dot, fromSpherical, getPhi, getR, getTheta, getX, getY, getZ, hadamard, isVector3, magnitude, make, normalize, scale, setPhi, setR, setTheta, setX, setY, setZ, softmax, subtract, zero };
77
+ export { type Vector3, add, components, cross, dot, fromSpherical, getPhi, getR, getTheta, getX, getY, getZ, hadamard, isVector3, magnitude, make, normalize, scale, setPhi, setR, setTheta, setX, setY, setZ, softmax, subtract, zero };
@@ -20,6 +20,10 @@ declare const dot: {
20
20
  (a: Vector3, b: Vector3): number;
21
21
  (b: Vector3): (a: Vector3) => number;
22
22
  };
23
+ declare const cross: {
24
+ (a: Vector3, b: Vector3): Vector3;
25
+ (b: Vector3): (a: Vector3) => Vector3;
26
+ };
23
27
  declare const components: (v: Vector3) => [number, number, number];
24
28
  declare const softmax: (v: Vector3) => Vector3;
25
29
  declare const zero: Vector3;
@@ -70,4 +74,4 @@ declare const setPhi: {
70
74
  (phi: number): (v: Vector3) => Vector3;
71
75
  };
72
76
 
73
- export { type Vector3, add, components, dot, fromSpherical, getPhi, getR, getTheta, getX, getY, getZ, hadamard, isVector3, magnitude, make, normalize, scale, setPhi, setR, setTheta, setX, setY, setZ, softmax, subtract, zero };
77
+ export { type Vector3, add, components, cross, dot, fromSpherical, getPhi, getR, getTheta, getX, getY, getZ, hadamard, isVector3, magnitude, make, normalize, scale, setPhi, setR, setTheta, setX, setY, setZ, softmax, subtract, zero };
@@ -1,4 +1,4 @@
1
- import { i as isVector3$1, m as make$1, f as fromSpherical$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, g as scale$1, j as getX$1, k as setX$1, l as getY$1, o as setY$1, p as getZ$1, q as setZ$1, r as setR$1, t as getTheta$1, u as setTheta$1, v as getPhi$1, w as setPhi$1 } from '../shared/curvy.Ck0of1PI.mjs';
1
+ import { i as isVector3$1, m as make$1, f as fromSpherical$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 getZ$1, r as setZ$1, t as setR$1, u as getTheta$1, v as setTheta$1, w as getPhi$1, x as setPhi$1 } from '../shared/curvy.wYJQhFW-.mjs';
2
2
  import '../pipe.mjs';
3
3
  import '../utils.mjs';
4
4
 
@@ -8,6 +8,7 @@ const fromSpherical = fromSpherical$1;
8
8
  const magnitude = magnitude$1;
9
9
  const normalize = normalize$1;
10
10
  const dot = dot$1;
11
+ const cross = cross$1;
11
12
  const components = components$1;
12
13
  const softmax = softmax$1;
13
14
  const zero = make(0);
@@ -28,4 +29,4 @@ const setTheta = setTheta$1;
28
29
  const getPhi = getPhi$1;
29
30
  const setPhi = setPhi$1;
30
31
 
31
- export { add, components, dot, fromSpherical, getPhi, getR, getTheta, getX, getY, getZ, hadamard, isVector3, magnitude, make, normalize, scale, setPhi, setR, setTheta, setX, setY, setZ, softmax, subtract, zero };
32
+ export { add, components, cross, dot, fromSpherical, getPhi, getR, getTheta, getX, getY, getZ, hadamard, isVector3, magnitude, make, normalize, scale, setPhi, setR, setTheta, setX, setY, setZ, softmax, subtract, zero };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "curvy",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Spline and Curve utilities",
5
5
  "author": "Tim Morris <timthewebguy@gmail.com>",
6
6
  "homepage": "https://github.com/tkofh/curvy#readme",