@mojir/lits 2.1.7 → 2.1.10
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.
- package/dist/cli/cli.js +382 -30
- package/dist/cli/reference/api.d.ts +3 -3
- package/dist/cli/reference/index.d.ts +6 -0
- package/dist/cli/src/builtin/normalExpressions/categories/namespaces/linearAlgebra/helpers/dot.d.ts +1 -0
- package/dist/cli/src/builtin/normalExpressions/categories/namespaces/linearAlgebra/helpers/getUnit.d.ts +2 -0
- package/dist/cli/src/builtin/normalExpressions/categories/namespaces/linearAlgebra/helpers/scale.d.ts +1 -0
- package/dist/cli/src/builtin/normalExpressions/categories/namespaces/linearAlgebra/helpers/subtract.d.ts +1 -0
- package/dist/cli/src/typeGuards/annotatedArrays.d.ts +4 -0
- package/dist/cli/src/utils/index.d.ts +1 -1
- package/dist/index.esm.js +381 -29
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +381 -29
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +381 -29
- package/dist/lits.iife.js.map +1 -1
- package/dist/reference/api.d.ts +3 -3
- package/dist/reference/index.d.ts +6 -0
- package/dist/src/builtin/normalExpressions/categories/namespaces/linearAlgebra/helpers/dot.d.ts +1 -0
- package/dist/src/builtin/normalExpressions/categories/namespaces/linearAlgebra/helpers/getUnit.d.ts +2 -0
- package/dist/src/builtin/normalExpressions/categories/namespaces/linearAlgebra/helpers/scale.d.ts +1 -0
- package/dist/src/builtin/normalExpressions/categories/namespaces/linearAlgebra/helpers/subtract.d.ts +1 -0
- package/dist/src/typeGuards/annotatedArrays.d.ts +4 -0
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/testFramework.esm.js +194 -28
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +194 -28
- package/dist/testFramework.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/cli.js
CHANGED
|
@@ -92,7 +92,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
92
92
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
var version = "2.1.
|
|
95
|
+
var version = "2.1.10";
|
|
96
96
|
|
|
97
97
|
function getCodeMarker(sourceCodeInfo) {
|
|
98
98
|
if (!sourceCodeInfo.position || !sourceCodeInfo.code)
|
|
@@ -824,7 +824,7 @@ function deepEqual(a, b, sourceCodeInfo) {
|
|
|
824
824
|
if (a === b)
|
|
825
825
|
return true;
|
|
826
826
|
if (typeof a === 'number' && typeof b === 'number')
|
|
827
|
-
return Math.abs(a - b) <
|
|
827
|
+
return Math.abs(a - b) < 1e-10;
|
|
828
828
|
if (Array.isArray(a) && Array.isArray(b)) {
|
|
829
829
|
if (a.length !== b.length)
|
|
830
830
|
return false;
|
|
@@ -843,7 +843,7 @@ function deepEqual(a, b, sourceCodeInfo) {
|
|
|
843
843
|
return false;
|
|
844
844
|
for (var i = 0; i < aKeys.length; i += 1) {
|
|
845
845
|
var key = asString(aKeys[i], sourceCodeInfo);
|
|
846
|
-
if (!deepEqual(
|
|
846
|
+
if (!deepEqual(a[key], b[key], sourceCodeInfo))
|
|
847
847
|
return false;
|
|
848
848
|
}
|
|
849
849
|
return true;
|
|
@@ -2308,6 +2308,28 @@ function assertVector(vector, sourceCodeInfo) {
|
|
|
2308
2308
|
throw new LitsError("Expected a vector, but got ".concat(vector), sourceCodeInfo);
|
|
2309
2309
|
}
|
|
2310
2310
|
}
|
|
2311
|
+
function is2dVector(vector) {
|
|
2312
|
+
if (!isVector(vector)) {
|
|
2313
|
+
return false;
|
|
2314
|
+
}
|
|
2315
|
+
return vector.length === 2;
|
|
2316
|
+
}
|
|
2317
|
+
function assert2dVector(vector, sourceCodeInfo) {
|
|
2318
|
+
if (!is2dVector(vector)) {
|
|
2319
|
+
throw new LitsError("Expected a 2d vector, but got ".concat(vector), sourceCodeInfo);
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
function is3dVector(vector) {
|
|
2323
|
+
if (!isVector(vector)) {
|
|
2324
|
+
return false;
|
|
2325
|
+
}
|
|
2326
|
+
return vector.length === 3;
|
|
2327
|
+
}
|
|
2328
|
+
function assert3dVector(vector, sourceCodeInfo) {
|
|
2329
|
+
if (!is3dVector(vector)) {
|
|
2330
|
+
throw new LitsError("Expected a 3d vector, but got ".concat(vector), sourceCodeInfo);
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2311
2333
|
function assertNonEmptyVector(vector, sourceCodeInfo) {
|
|
2312
2334
|
assertVector(vector, sourceCodeInfo);
|
|
2313
2335
|
if (vector.length === 0) {
|
|
@@ -4688,6 +4710,24 @@ var gridNormalExpression = {
|
|
|
4688
4710
|
},
|
|
4689
4711
|
paramCount: 1,
|
|
4690
4712
|
},
|
|
4713
|
+
'grid:fill': {
|
|
4714
|
+
evaluate: function (_a, sourceCodeInfo) {
|
|
4715
|
+
var _b = __read(_a, 3), rows = _b[0], cols = _b[1], value = _b[2];
|
|
4716
|
+
assertNumber(rows, sourceCodeInfo, { integer: true, positive: true });
|
|
4717
|
+
assertNumber(cols, sourceCodeInfo, { integer: true, positive: true });
|
|
4718
|
+
assertAny(value, sourceCodeInfo);
|
|
4719
|
+
var result = [];
|
|
4720
|
+
for (var i = 0; i < rows; i += 1) {
|
|
4721
|
+
var row = [];
|
|
4722
|
+
for (var j = 0; j < cols; j += 1) {
|
|
4723
|
+
row.push(value);
|
|
4724
|
+
}
|
|
4725
|
+
result.push(row);
|
|
4726
|
+
}
|
|
4727
|
+
return result;
|
|
4728
|
+
},
|
|
4729
|
+
paramCount: 3,
|
|
4730
|
+
},
|
|
4691
4731
|
'grid:generate': {
|
|
4692
4732
|
evaluate: function (_a, sourceCodeInfo, contextStack, _b) {
|
|
4693
4733
|
var _c = __read(_a, 3), rows = _c[0], cols = _c[1], generator = _c[2];
|
|
@@ -4738,6 +4778,7 @@ var gridNormalExpression = {
|
|
|
4738
4778
|
return transpose(grid);
|
|
4739
4779
|
},
|
|
4740
4780
|
paramCount: 1,
|
|
4781
|
+
aliases: ['grid:tr'],
|
|
4741
4782
|
},
|
|
4742
4783
|
'grid:flip-h': {
|
|
4743
4784
|
evaluate: function (_a, sourceCodeInfo) {
|
|
@@ -6631,7 +6672,137 @@ function extractOverlappingSegments(vectorA, vectorB, lag) {
|
|
|
6631
6672
|
return [segmentA, segmentB];
|
|
6632
6673
|
}
|
|
6633
6674
|
|
|
6675
|
+
function getUnit(value, sourceCodeInfo) {
|
|
6676
|
+
if (value.length === 0) {
|
|
6677
|
+
return value;
|
|
6678
|
+
}
|
|
6679
|
+
var length = Math.sqrt(value.reduce(function (acc, item) { return acc + Math.pow(item, 2); }, 0));
|
|
6680
|
+
if (approxZero(length)) {
|
|
6681
|
+
throw new LitsError('The vector must not be zero', sourceCodeInfo);
|
|
6682
|
+
}
|
|
6683
|
+
return value.map(function (item) { return item / length; });
|
|
6684
|
+
}
|
|
6685
|
+
|
|
6686
|
+
function dot(vector1, vector2) {
|
|
6687
|
+
return vector1.reduce(function (acc, item, index) { return acc + item * vector2[index]; }, 0);
|
|
6688
|
+
}
|
|
6689
|
+
|
|
6690
|
+
function subtract(vector1, vector2) {
|
|
6691
|
+
return vector1.map(function (item, index) { return item - vector2[index]; });
|
|
6692
|
+
}
|
|
6693
|
+
|
|
6694
|
+
function scale(vector, scalar) {
|
|
6695
|
+
return vector.map(function (item) { return item * scalar; });
|
|
6696
|
+
}
|
|
6697
|
+
|
|
6634
6698
|
var linearAlgebraNormalExpression = {
|
|
6699
|
+
'lin:rotate2d': {
|
|
6700
|
+
evaluate: function (_a, sourceCodeInfo) {
|
|
6701
|
+
var _b = __read(_a, 2), vector = _b[0], radians = _b[1];
|
|
6702
|
+
assert2dVector(vector, sourceCodeInfo);
|
|
6703
|
+
if (isZeroVector(vector)) {
|
|
6704
|
+
return vector;
|
|
6705
|
+
}
|
|
6706
|
+
assertNumber(radians, sourceCodeInfo, { finite: true });
|
|
6707
|
+
var cosTheta = Math.cos(radians);
|
|
6708
|
+
var sinTheta = Math.sin(radians);
|
|
6709
|
+
return [
|
|
6710
|
+
vector[0] * cosTheta - vector[1] * sinTheta,
|
|
6711
|
+
vector[0] * sinTheta + vector[1] * cosTheta,
|
|
6712
|
+
];
|
|
6713
|
+
},
|
|
6714
|
+
paramCount: 2,
|
|
6715
|
+
},
|
|
6716
|
+
'lin:rotate3d': {
|
|
6717
|
+
evaluate: function (_a, sourceCodeInfo) {
|
|
6718
|
+
var _b = __read(_a, 3), vector = _b[0], axis = _b[1], radians = _b[2];
|
|
6719
|
+
assert3dVector(vector, sourceCodeInfo);
|
|
6720
|
+
if (isZeroVector(vector)) {
|
|
6721
|
+
return vector;
|
|
6722
|
+
}
|
|
6723
|
+
assertNumber(radians, sourceCodeInfo, { finite: true });
|
|
6724
|
+
assert3dVector(axis, sourceCodeInfo);
|
|
6725
|
+
if (isZeroVector(axis)) {
|
|
6726
|
+
throw new LitsError('Rotation axis must not be zero', sourceCodeInfo);
|
|
6727
|
+
}
|
|
6728
|
+
var cosTheta = Math.cos(radians);
|
|
6729
|
+
var sinTheta = Math.sin(radians);
|
|
6730
|
+
var _c = __read(getUnit(axis, sourceCodeInfo), 3), u = _c[0], v = _c[1], w = _c[2];
|
|
6731
|
+
var dotProduct = vector[0] * u + vector[1] * v + vector[2] * w;
|
|
6732
|
+
return [
|
|
6733
|
+
dotProduct * u * (1 - cosTheta) + vector[0] * cosTheta + (-w * vector[1] + v * vector[2]) * sinTheta,
|
|
6734
|
+
dotProduct * v * (1 - cosTheta) + vector[1] * cosTheta + (w * vector[0] - u * vector[2]) * sinTheta,
|
|
6735
|
+
dotProduct * w * (1 - cosTheta) + vector[2] * cosTheta + (-v * vector[0] + u * vector[1]) * sinTheta,
|
|
6736
|
+
];
|
|
6737
|
+
},
|
|
6738
|
+
paramCount: 3,
|
|
6739
|
+
},
|
|
6740
|
+
'lin:reflect': {
|
|
6741
|
+
evaluate: function (_a, sourceCodeInfo) {
|
|
6742
|
+
var _b = __read(_a, 2), vector = _b[0], normal = _b[1];
|
|
6743
|
+
assertVector(vector, sourceCodeInfo);
|
|
6744
|
+
assertVector(normal, sourceCodeInfo);
|
|
6745
|
+
if (vector.length !== normal.length) {
|
|
6746
|
+
throw new LitsError('Vectors must be of the same length', sourceCodeInfo);
|
|
6747
|
+
}
|
|
6748
|
+
if (isZeroVector(normal)) {
|
|
6749
|
+
throw new LitsError('Reflection normal must not be zero', sourceCodeInfo);
|
|
6750
|
+
}
|
|
6751
|
+
if (isZeroVector(vector)) {
|
|
6752
|
+
return vector;
|
|
6753
|
+
}
|
|
6754
|
+
var unitNormal = getUnit(normal, sourceCodeInfo);
|
|
6755
|
+
var doubleDot = 2 * dot(vector, unitNormal);
|
|
6756
|
+
return subtract(vector, scale(unitNormal, doubleDot));
|
|
6757
|
+
},
|
|
6758
|
+
paramCount: 2,
|
|
6759
|
+
},
|
|
6760
|
+
'lin:refract': {
|
|
6761
|
+
evaluate: function (_a, sourceCodeInfo) {
|
|
6762
|
+
var _b = __read(_a, 3), vector = _b[0], normal = _b[1], eta = _b[2];
|
|
6763
|
+
assertVector(vector, sourceCodeInfo);
|
|
6764
|
+
assertVector(normal, sourceCodeInfo);
|
|
6765
|
+
assertNumber(eta, sourceCodeInfo, { finite: true, positive: true });
|
|
6766
|
+
if (vector.length !== normal.length) {
|
|
6767
|
+
throw new LitsError('Vectors must be of the same length', sourceCodeInfo);
|
|
6768
|
+
}
|
|
6769
|
+
if (isZeroVector(normal)) {
|
|
6770
|
+
throw new LitsError('Refraction normal must not be zero', sourceCodeInfo);
|
|
6771
|
+
}
|
|
6772
|
+
if (isZeroVector(vector)) {
|
|
6773
|
+
return vector;
|
|
6774
|
+
}
|
|
6775
|
+
// Make sure vectors are normalized
|
|
6776
|
+
var normalizedV = getUnit(vector, sourceCodeInfo);
|
|
6777
|
+
var normalizedNormal = getUnit(normal, sourceCodeInfo);
|
|
6778
|
+
// Calculate dot product between incident vector and normal
|
|
6779
|
+
var dotProduct = dot(normalizedV, normalizedNormal);
|
|
6780
|
+
// Calculate discriminant
|
|
6781
|
+
var discriminant = 1 - eta * eta * (1 - dotProduct * dotProduct);
|
|
6782
|
+
// Check for total internal reflection
|
|
6783
|
+
if (discriminant < 0) {
|
|
6784
|
+
return vector; // Total internal reflection occurs
|
|
6785
|
+
}
|
|
6786
|
+
// Calculate the refracted vector
|
|
6787
|
+
var scaledIncident = scale(normalizedV, eta);
|
|
6788
|
+
var scaledNormal = scale(normalizedNormal, eta * dotProduct + Math.sqrt(discriminant));
|
|
6789
|
+
return subtract(scaledIncident, scaledNormal);
|
|
6790
|
+
},
|
|
6791
|
+
paramCount: 3,
|
|
6792
|
+
},
|
|
6793
|
+
'lin:lerp': {
|
|
6794
|
+
evaluate: function (_a, sourceCodeInfo) {
|
|
6795
|
+
var _b = __read(_a, 3), vectorA = _b[0], vectorB = _b[1], t = _b[2];
|
|
6796
|
+
assertVector(vectorA, sourceCodeInfo);
|
|
6797
|
+
assertVector(vectorB, sourceCodeInfo);
|
|
6798
|
+
assertNumber(t, sourceCodeInfo, { finite: true });
|
|
6799
|
+
if (vectorA.length !== vectorB.length) {
|
|
6800
|
+
throw new LitsError('Vectors must be of the same length', sourceCodeInfo);
|
|
6801
|
+
}
|
|
6802
|
+
return vectorA.map(function (val, i) { return val + (vectorB[i] - val) * t; });
|
|
6803
|
+
},
|
|
6804
|
+
paramCount: 3,
|
|
6805
|
+
},
|
|
6635
6806
|
'lin:dot': {
|
|
6636
6807
|
evaluate: function (_a, sourceCodeInfo) {
|
|
6637
6808
|
var _b = __read(_a, 2), vectorA = _b[0], vectorB = _b[1];
|
|
@@ -6640,7 +6811,7 @@ var linearAlgebraNormalExpression = {
|
|
|
6640
6811
|
if (vectorA.length !== vectorB.length) {
|
|
6641
6812
|
throw new LitsError('Vectors must be of the same length', sourceCodeInfo);
|
|
6642
6813
|
}
|
|
6643
|
-
return vectorA
|
|
6814
|
+
return dot(vectorA, vectorB);
|
|
6644
6815
|
},
|
|
6645
6816
|
paramCount: 2,
|
|
6646
6817
|
},
|
|
@@ -6721,16 +6892,10 @@ var linearAlgebraNormalExpression = {
|
|
|
6721
6892
|
evaluate: function (_a, sourceCodeInfo) {
|
|
6722
6893
|
var _b = __read(_a, 1), vector = _b[0];
|
|
6723
6894
|
assertVector(vector, sourceCodeInfo);
|
|
6724
|
-
|
|
6725
|
-
return [];
|
|
6726
|
-
}
|
|
6727
|
-
var norm = Math.sqrt(vector.reduce(function (acc, val) { return acc + Math.pow(val, 2); }, 0));
|
|
6728
|
-
if (norm === 0) {
|
|
6729
|
-
return vector.map(function () { return 0; });
|
|
6730
|
-
}
|
|
6731
|
-
return vector.map(function (val) { return val / norm; });
|
|
6895
|
+
return getUnit(vector, sourceCodeInfo);
|
|
6732
6896
|
},
|
|
6733
6897
|
paramCount: 1,
|
|
6898
|
+
aliases: ['lin:unit', 'lin:normalize'],
|
|
6734
6899
|
},
|
|
6735
6900
|
'lin:normalize-log': {
|
|
6736
6901
|
evaluate: function (_a, sourceCodeInfo) {
|
|
@@ -6857,7 +7022,7 @@ var linearAlgebraNormalExpression = {
|
|
|
6857
7022
|
return Math.sqrt(vector.reduce(function (acc, val) { return acc + val * val; }, 0));
|
|
6858
7023
|
},
|
|
6859
7024
|
paramCount: 1,
|
|
6860
|
-
aliases: ['lin:l2-norm', 'lin:
|
|
7025
|
+
aliases: ['lin:l2-norm', 'lin:length'],
|
|
6861
7026
|
},
|
|
6862
7027
|
'lin:manhattan-distance': {
|
|
6863
7028
|
evaluate: function (_a, sourceCodeInfo) {
|
|
@@ -12327,6 +12492,7 @@ function evaluateReservedSymbol(node) {
|
|
|
12327
12492
|
return asNonUndefined(value, node[2]);
|
|
12328
12493
|
}
|
|
12329
12494
|
function evaluateNormalExpression(node, contextStack) {
|
|
12495
|
+
var _a, _b;
|
|
12330
12496
|
var sourceCodeInfo = node[2];
|
|
12331
12497
|
var paramNodes = node[1][1];
|
|
12332
12498
|
var params = [];
|
|
@@ -12352,14 +12518,14 @@ function evaluateNormalExpression(node, contextStack) {
|
|
|
12352
12518
|
var nameSymbol = node[1][0];
|
|
12353
12519
|
if (placeholders.length > 0) {
|
|
12354
12520
|
var fn = evaluateNode(nameSymbol, contextStack);
|
|
12355
|
-
var partialFunction = {
|
|
12356
|
-
|
|
12357
|
-
|
|
12358
|
-
|
|
12359
|
-
params
|
|
12360
|
-
placeholders
|
|
12361
|
-
sourceCodeInfo
|
|
12362
|
-
|
|
12521
|
+
var partialFunction = (_a = {},
|
|
12522
|
+
_a[FUNCTION_SYMBOL] = true,
|
|
12523
|
+
_a.function = asFunctionLike(fn, sourceCodeInfo),
|
|
12524
|
+
_a.functionType = 'Partial',
|
|
12525
|
+
_a.params = params,
|
|
12526
|
+
_a.placeholders = placeholders,
|
|
12527
|
+
_a.sourceCodeInfo = sourceCodeInfo,
|
|
12528
|
+
_a);
|
|
12363
12529
|
return partialFunction;
|
|
12364
12530
|
}
|
|
12365
12531
|
if (isNormalBuiltinSymbolNode(nameSymbol)) {
|
|
@@ -12379,14 +12545,14 @@ function evaluateNormalExpression(node, contextStack) {
|
|
|
12379
12545
|
var fnNode = node[1][0];
|
|
12380
12546
|
var fn = asFunctionLike(evaluateNode(fnNode, contextStack), sourceCodeInfo);
|
|
12381
12547
|
if (placeholders.length > 0) {
|
|
12382
|
-
var partialFunction = {
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12386
|
-
params
|
|
12387
|
-
placeholders
|
|
12388
|
-
sourceCodeInfo
|
|
12389
|
-
|
|
12548
|
+
var partialFunction = (_b = {},
|
|
12549
|
+
_b[FUNCTION_SYMBOL] = true,
|
|
12550
|
+
_b.function = asFunctionLike(fn, sourceCodeInfo),
|
|
12551
|
+
_b.functionType = 'Partial',
|
|
12552
|
+
_b.params = params,
|
|
12553
|
+
_b.placeholders = placeholders,
|
|
12554
|
+
_b.sourceCodeInfo = sourceCodeInfo,
|
|
12555
|
+
_b);
|
|
12390
12556
|
return partialFunction;
|
|
12391
12557
|
}
|
|
12392
12558
|
return executeFunction(fn, params, contextStack, sourceCodeInfo);
|
|
@@ -15103,6 +15269,7 @@ var api = {
|
|
|
15103
15269
|
'grid:row',
|
|
15104
15270
|
'grid:col',
|
|
15105
15271
|
'grid:shape',
|
|
15272
|
+
'grid:fill',
|
|
15106
15273
|
'grid:generate',
|
|
15107
15274
|
'grid:reshape',
|
|
15108
15275
|
'grid:transpose',
|
|
@@ -15194,6 +15361,11 @@ var api = {
|
|
|
15194
15361
|
'vec:smape'
|
|
15195
15362
|
], __read(getVectorReductionNames('mean')), false), __read(getVectorReductionNames('median')), false), __read(getVectorReductionNames('variance')), false), __read(getVectorReductionNames('sample-variance')), false), __read(getVectorReductionNames('sum')), false), __read(getVectorReductionNames('prod')), false), __read(getVectorReductionNames('min')), false), __read(getVectorReductionNames('max')), false), __read(getVectorReductionNames('stdev')), false), __read(getVectorReductionNames('sample-stdev')), false), __read(getVectorReductionNames('iqr')), false), __read(getVectorReductionNames('span')), false), __read(getVectorReductionNames('geometric-mean')), false), __read(getVectorReductionNames('harmonic-mean')), false), __read(getVectorReductionNames('skewness')), false), __read(getVectorReductionNames('sample-skewness')), false), __read(getVectorReductionNames('kurtosis')), false), __read(getVectorReductionNames('sample-kurtosis')), false), __read(getVectorReductionNames('excess-kurtosis')), false), __read(getVectorReductionNames('sample-excess-kurtosis')), false), __read(getVectorReductionNames('rms')), false), __read(getVectorReductionNames('mad')), false), __read(getVectorReductionNames('medad')), false), __read(getVectorReductionNames('gini-coefficient')), false), __read(getVectorReductionNames('entropy')), false), __read(getVectorReductionNames('skewness')), false),
|
|
15196
15363
|
linAlg: [
|
|
15364
|
+
'lin:reflect',
|
|
15365
|
+
'lin:refract',
|
|
15366
|
+
'lin:lerp',
|
|
15367
|
+
'lin:rotate2d',
|
|
15368
|
+
'lin:rotate3d',
|
|
15197
15369
|
'lin:dot',
|
|
15198
15370
|
'lin:cross',
|
|
15199
15371
|
'lin:normalize-minmax',
|
|
@@ -19043,6 +19215,36 @@ var gridReference = {
|
|
|
19043
19215
|
"grid:shape(".concat(exampleGrid3, ")"),
|
|
19044
19216
|
],
|
|
19045
19217
|
},
|
|
19218
|
+
'grid:fill': {
|
|
19219
|
+
title: 'grid:fill',
|
|
19220
|
+
category: 'Grid',
|
|
19221
|
+
linkName: 'grid-colon-fill',
|
|
19222
|
+
returns: {
|
|
19223
|
+
type: 'grid',
|
|
19224
|
+
},
|
|
19225
|
+
args: {
|
|
19226
|
+
rows: {
|
|
19227
|
+
type: 'integer',
|
|
19228
|
+
description: 'The number of rows in the grid.',
|
|
19229
|
+
},
|
|
19230
|
+
cols: {
|
|
19231
|
+
type: 'integer',
|
|
19232
|
+
description: 'The number of columns in the grid.',
|
|
19233
|
+
},
|
|
19234
|
+
value: {
|
|
19235
|
+
type: 'any',
|
|
19236
|
+
description: 'The value to fill the grid with.',
|
|
19237
|
+
},
|
|
19238
|
+
},
|
|
19239
|
+
variants: [
|
|
19240
|
+
{ argumentNames: ['rows', 'cols', 'value'] },
|
|
19241
|
+
],
|
|
19242
|
+
description: 'Creates a grid of the specified size, filled with the specified value.',
|
|
19243
|
+
examples: [
|
|
19244
|
+
'grid:fill(2, 3, 0)',
|
|
19245
|
+
'grid:fill(2, 3, "x")',
|
|
19246
|
+
],
|
|
19247
|
+
},
|
|
19046
19248
|
'grid:generate': {
|
|
19047
19249
|
title: 'grid:generate',
|
|
19048
19250
|
category: 'Grid',
|
|
@@ -19110,6 +19312,7 @@ var gridReference = {
|
|
|
19110
19312
|
"grid:transpose(".concat(exampleGrid2, ")"),
|
|
19111
19313
|
"grid:transpose(".concat(exampleGrid3, ")"),
|
|
19112
19314
|
],
|
|
19315
|
+
aliases: ['grid:tr'],
|
|
19113
19316
|
},
|
|
19114
19317
|
'grid:flip-h': {
|
|
19115
19318
|
title: 'grid:flip-h',
|
|
@@ -23264,6 +23467,150 @@ var vectorReference = __assign(__assign(__assign(__assign(__assign(__assign(__as
|
|
|
23264
23467
|
} });
|
|
23265
23468
|
|
|
23266
23469
|
var linAlgReference = {
|
|
23470
|
+
'lin:reflect': {
|
|
23471
|
+
title: 'lin:reflect',
|
|
23472
|
+
category: 'Linear Algebra',
|
|
23473
|
+
description: 'Reflects a vector across a given axis.',
|
|
23474
|
+
linkName: 'lin-colon-reflect',
|
|
23475
|
+
returns: {
|
|
23476
|
+
type: 'vector',
|
|
23477
|
+
},
|
|
23478
|
+
args: {
|
|
23479
|
+
a: {
|
|
23480
|
+
type: 'vector',
|
|
23481
|
+
description: 'Vector to reflect.',
|
|
23482
|
+
},
|
|
23483
|
+
b: {
|
|
23484
|
+
type: 'vector',
|
|
23485
|
+
description: 'Axis of reflection.',
|
|
23486
|
+
},
|
|
23487
|
+
},
|
|
23488
|
+
variants: [
|
|
23489
|
+
{ argumentNames: ['a', 'b'] },
|
|
23490
|
+
],
|
|
23491
|
+
examples: [
|
|
23492
|
+
'lin:reflect([1, 2], [0, 1])',
|
|
23493
|
+
'lin:reflect([1, 2, 3], [0, 0, 1])',
|
|
23494
|
+
],
|
|
23495
|
+
},
|
|
23496
|
+
'lin:refract': {
|
|
23497
|
+
title: 'lin:refract',
|
|
23498
|
+
category: 'Linear Algebra',
|
|
23499
|
+
description: 'Refracts a vector across a given axis.',
|
|
23500
|
+
linkName: 'lin-colon-refract',
|
|
23501
|
+
returns: {
|
|
23502
|
+
type: 'vector',
|
|
23503
|
+
},
|
|
23504
|
+
args: {
|
|
23505
|
+
vector: {
|
|
23506
|
+
type: 'vector',
|
|
23507
|
+
description: 'Vector to refract.',
|
|
23508
|
+
},
|
|
23509
|
+
axis: {
|
|
23510
|
+
type: 'vector',
|
|
23511
|
+
description: 'Axis of refraction.',
|
|
23512
|
+
},
|
|
23513
|
+
eta: {
|
|
23514
|
+
type: 'number',
|
|
23515
|
+
description: 'Refraction index.',
|
|
23516
|
+
},
|
|
23517
|
+
},
|
|
23518
|
+
variants: [
|
|
23519
|
+
{ argumentNames: ['vector', 'axis', 'eta'] },
|
|
23520
|
+
],
|
|
23521
|
+
examples: [
|
|
23522
|
+
'lin:refract([1, 2], [0, 1], 1.5)',
|
|
23523
|
+
'lin:refract([1, 2, 3], [0, 0, 1], 1.5)',
|
|
23524
|
+
],
|
|
23525
|
+
},
|
|
23526
|
+
'lin:lerp': {
|
|
23527
|
+
title: 'lin:lerp',
|
|
23528
|
+
category: 'Linear Algebra',
|
|
23529
|
+
description: 'Performs linear interpolation between two vectors.',
|
|
23530
|
+
linkName: 'lin-colon-lerp',
|
|
23531
|
+
returns: {
|
|
23532
|
+
type: 'vector',
|
|
23533
|
+
},
|
|
23534
|
+
args: {
|
|
23535
|
+
a: {
|
|
23536
|
+
type: 'vector',
|
|
23537
|
+
description: 'Start vector.',
|
|
23538
|
+
},
|
|
23539
|
+
b: {
|
|
23540
|
+
type: 'vector',
|
|
23541
|
+
description: 'End vector.',
|
|
23542
|
+
},
|
|
23543
|
+
t: {
|
|
23544
|
+
type: 'number',
|
|
23545
|
+
description: 'Interpolation factor (0 to 1).',
|
|
23546
|
+
},
|
|
23547
|
+
},
|
|
23548
|
+
variants: [
|
|
23549
|
+
{ argumentNames: ['a', 'b', 't'] },
|
|
23550
|
+
],
|
|
23551
|
+
examples: [
|
|
23552
|
+
'lin:lerp([1, 2], [3, 4], 0.5)',
|
|
23553
|
+
'lin:lerp([1, 2], [3, 4], 2)',
|
|
23554
|
+
'lin:lerp([1, 2], [3, 4], -1)',
|
|
23555
|
+
'lin:lerp([1, 2, 3], [4, 5, 6], 0.25)',
|
|
23556
|
+
],
|
|
23557
|
+
},
|
|
23558
|
+
'lin:rotate2d': {
|
|
23559
|
+
title: 'lin:rotate2d',
|
|
23560
|
+
category: 'Linear Algebra',
|
|
23561
|
+
description: 'Rotates a 2D vector by a given angle in radians.',
|
|
23562
|
+
linkName: 'lin-colon-rotate2d',
|
|
23563
|
+
returns: {
|
|
23564
|
+
type: 'vector',
|
|
23565
|
+
},
|
|
23566
|
+
args: {
|
|
23567
|
+
a: {
|
|
23568
|
+
type: 'vector',
|
|
23569
|
+
description: 'Vector to rotate.',
|
|
23570
|
+
},
|
|
23571
|
+
b: {
|
|
23572
|
+
type: 'number',
|
|
23573
|
+
description: 'Angle in b.',
|
|
23574
|
+
},
|
|
23575
|
+
},
|
|
23576
|
+
variants: [
|
|
23577
|
+
{ argumentNames: ['a', 'b'] },
|
|
23578
|
+
],
|
|
23579
|
+
examples: [
|
|
23580
|
+
'lin:rotate2d([1, 0], PI / 2)',
|
|
23581
|
+
'lin:rotate2d([0, 1], PI)',
|
|
23582
|
+
],
|
|
23583
|
+
},
|
|
23584
|
+
'lin:rotate3d': {
|
|
23585
|
+
title: 'lin:rotate3d',
|
|
23586
|
+
category: 'Linear Algebra',
|
|
23587
|
+
description: 'Rotates a 3D vector around a given axis by a given angle in radians.',
|
|
23588
|
+
linkName: 'lin-colon-rotate3d',
|
|
23589
|
+
returns: {
|
|
23590
|
+
type: 'vector',
|
|
23591
|
+
},
|
|
23592
|
+
args: {
|
|
23593
|
+
v: {
|
|
23594
|
+
type: 'vector',
|
|
23595
|
+
description: 'Vector to rotate.',
|
|
23596
|
+
},
|
|
23597
|
+
axis: {
|
|
23598
|
+
type: 'vector',
|
|
23599
|
+
description: 'Axis of rotation.',
|
|
23600
|
+
},
|
|
23601
|
+
radians: {
|
|
23602
|
+
type: 'number',
|
|
23603
|
+
description: 'Angle in radians.',
|
|
23604
|
+
},
|
|
23605
|
+
},
|
|
23606
|
+
variants: [
|
|
23607
|
+
{ argumentNames: ['v', 'axis', 'radians'] },
|
|
23608
|
+
],
|
|
23609
|
+
examples: [
|
|
23610
|
+
'lin:rotate3d([1, 0, 0], [0, 1, 0], PI / 2)',
|
|
23611
|
+
'lin:rotate3d([0, 1, 0], [1, 0, 0], PI)',
|
|
23612
|
+
],
|
|
23613
|
+
},
|
|
23267
23614
|
'lin:dot': {
|
|
23268
23615
|
title: 'lin:dot',
|
|
23269
23616
|
category: 'Linear Algebra',
|
|
@@ -23438,11 +23785,16 @@ var linAlgReference = {
|
|
|
23438
23785
|
],
|
|
23439
23786
|
examples: [
|
|
23440
23787
|
'lin:normalize-l2([1, 2, 3])',
|
|
23788
|
+
'lin:unit([1, 2, 3])',
|
|
23441
23789
|
'lin:normalize-l2([1, 2, -3])',
|
|
23442
23790
|
'lin:normalize-l2([1, 2, 3, 4])',
|
|
23443
23791
|
'lin:normalize-l2([1, 2, -3, 4])',
|
|
23444
23792
|
'lin:normalize-l2([1, 2, 3, 40, 50])',
|
|
23445
23793
|
],
|
|
23794
|
+
aliases: [
|
|
23795
|
+
'lin:unit',
|
|
23796
|
+
'lin:normalize',
|
|
23797
|
+
],
|
|
23446
23798
|
},
|
|
23447
23799
|
'lin:normalize-log': {
|
|
23448
23800
|
title: 'lin:normalize-log',
|
|
@@ -23620,7 +23972,7 @@ var linAlgReference = {
|
|
|
23620
23972
|
],
|
|
23621
23973
|
aliases: [
|
|
23622
23974
|
'lin:l2-norm',
|
|
23623
|
-
'lin:
|
|
23975
|
+
'lin:length',
|
|
23624
23976
|
],
|
|
23625
23977
|
},
|
|
23626
23978
|
'lin:manhattan-distance': {
|