dgeoutils 2.3.6 → 2.4.1
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/cjs/DCircle.js +52 -63
- package/dist/cjs/DLine.js +132 -181
- package/dist/cjs/DNumbers.js +16 -20
- package/dist/cjs/DPlane.js +56 -79
- package/dist/cjs/DPoint.js +240 -338
- package/dist/cjs/DPolygon.d.ts +1 -1
- package/dist/cjs/DPolygon.js +638 -1149
- package/dist/cjs/DPolygonLoop.js +138 -143
- package/dist/cjs/FastSearch.js +13 -37
- package/dist/cjs/TraceMatrix.js +87 -139
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/utils.d.ts +2 -1
- package/dist/cjs/utils.js +69 -97
- package/dist/es2015/DPolygon.js +5 -1
- package/dist/es2015/index.js +1 -1
- package/dist/es2015/utils.js +13 -0
- package/dist/esm/DPolygon.js +6 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/utils.js +13 -0
- package/dist/umd/dgeoutils.js +21 -2
- package/dist/umd/dgeoutils.min.js +1 -1
- package/dist/umd/dgeoutils.min.js.map +1 -1
- package/package.json +2 -2
package/dist/es2015/utils.js
CHANGED
|
@@ -147,3 +147,16 @@ export const createCanvas = (a, b, c) => {
|
|
|
147
147
|
};
|
|
148
148
|
const f = (a, b) => [].concat(...a.map((c) => b.map((d) => [].concat(c, d))));
|
|
149
149
|
export const cartesianProduct = (a, b, ...c) => b ? cartesianProduct(f(a, b), ...c) : a;
|
|
150
|
+
export const getCombinations = (arr) => {
|
|
151
|
+
if (arr.length === 1) {
|
|
152
|
+
return arr[0];
|
|
153
|
+
}
|
|
154
|
+
const ans = [];
|
|
155
|
+
const otherCases = getCombinations(arr.slice(1));
|
|
156
|
+
for (let i = 0; i < otherCases.length; i++) {
|
|
157
|
+
for (let j = 0; j < arr[0].length; j++) {
|
|
158
|
+
ans.push([arr[0][j], ...otherCases[i]]);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return ans;
|
|
162
|
+
};
|
package/dist/esm/DPolygon.js
CHANGED
|
@@ -958,8 +958,9 @@ var DPolygon = (function () {
|
|
|
958
958
|
DPolygon.prototype.toArrayOfCoords = function () {
|
|
959
959
|
return this.mapArray(function (r) { return r.toCoords(); });
|
|
960
960
|
};
|
|
961
|
-
DPolygon.prototype.divideToPieces = function (piecesCount) {
|
|
961
|
+
DPolygon.prototype.divideToPieces = function (piecesCount, withAltitude) {
|
|
962
962
|
var e_13, _a;
|
|
963
|
+
if (withAltitude === void 0) { withAltitude = false; }
|
|
963
964
|
var fullLength = this.fullLength;
|
|
964
965
|
var pieceLength = fullLength / piecesCount;
|
|
965
966
|
var currentPieceLength = pieceLength;
|
|
@@ -976,6 +977,10 @@ var DPolygon = (function () {
|
|
|
976
977
|
.filter(function (p) { return line_1.inRange(p, CLOSE_TO_INTERSECTION_DISTANCE); })[0];
|
|
977
978
|
intersectionPoint.properties.pieceBorder = true;
|
|
978
979
|
this_1.insertAfter(i, intersectionPoint);
|
|
980
|
+
if (withAltitude) {
|
|
981
|
+
var p1z = p1.z;
|
|
982
|
+
intersectionPoint.z = p1z - (p1z - p2.z) * (p1.distance(intersectionPoint) / d);
|
|
983
|
+
}
|
|
979
984
|
currentPieceLength = pieceLength;
|
|
980
985
|
}
|
|
981
986
|
else {
|
package/dist/esm/index.js
CHANGED
|
@@ -7,4 +7,4 @@ export * from './FastSearch';
|
|
|
7
7
|
export * from './TraceMatrix';
|
|
8
8
|
export * from './DPolygonLoop';
|
|
9
9
|
export * from './DPlane';
|
|
10
|
-
export { gaussianElimination, createCanvas, createArray, createMatrix, isDefAndNotNull, cartesianProduct, DGeo } from './utils';
|
|
10
|
+
export { gaussianElimination, createCanvas, createArray, createMatrix, isDefAndNotNull, cartesianProduct, getCombinations, DGeo } from './utils';
|
package/dist/esm/utils.js
CHANGED
|
@@ -189,3 +189,16 @@ export var cartesianProduct = function (a, b) {
|
|
|
189
189
|
}
|
|
190
190
|
return b ? cartesianProduct.apply(void 0, __spreadArray([f(a, b)], __read(c), false)) : a;
|
|
191
191
|
};
|
|
192
|
+
export var getCombinations = function (arr) {
|
|
193
|
+
if (arr.length === 1) {
|
|
194
|
+
return arr[0];
|
|
195
|
+
}
|
|
196
|
+
var ans = [];
|
|
197
|
+
var otherCases = getCombinations(arr.slice(1));
|
|
198
|
+
for (var i = 0; i < otherCases.length; i++) {
|
|
199
|
+
for (var j = 0; j < arr[0].length; j++) {
|
|
200
|
+
ans.push(__spreadArray([arr[0][j]], __read(otherCases[i]), false));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return ans;
|
|
204
|
+
};
|