@turf/planepoint 7.1.0 → 7.3.0
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/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +11 -11
package/dist/cjs/index.cjs
CHANGED
|
@@ -25,9 +25,9 @@ function planepoint(point, triangle) {
|
|
|
25
25
|
const z = (z3 * (x - x1) * (y - y2) + z1 * (x - x2) * (y - y3) + z2 * (x - x3) * (y - y1) - z2 * (x - x1) * (y - y3) - z3 * (x - x2) * (y - y1) - z1 * (x - x3) * (y - y2)) / ((x - x1) * (y - y2) + (x - x2) * (y - y3) + (x - x3) * (y - y1) - (x - x1) * (y - y3) - (x - x2) * (y - y1) - (x - x3) * (y - y2));
|
|
26
26
|
return z;
|
|
27
27
|
}
|
|
28
|
-
var
|
|
28
|
+
var index_default = planepoint;
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
exports.default =
|
|
32
|
+
exports.default = index_default; exports.planepoint = planepoint;
|
|
33
33
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-planepoint/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACCA,4CAAkC;AAoClC,SAAS,UAAA,CACP,KAAA,EACA,QAAA,EACQ;AAER,EAAA,MAAM,MAAA,EAAQ,iCAAA,KAAc,CAAA;AAC5B,EAAA,MAAM,KAAA,EAAO,gCAAA,QAAgB,CAAA;AAC7B,EAAA,MAAM,OAAA,EAAS,IAAA,CAAK,WAAA;AACpB,EAAA,MAAM,MAAA,EAAQ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AAM,CAAC,CAAA,CAAE,CAAC,CAAA;AAC3C,EAAA,MAAM,EAAA,EAAA,CACH,GAAA,EAAA,CAAM,EAAA,EAAI,EAAA,EAAA,EAAA,CAAO,EAAA,EAAI,EAAA,EAAA,EACpB,GAAA,EAAA,CAAM,EAAA,EAAI,EAAA,EAAA,EAAA,CAAO,EAAA,EAAI,EAAA,EAAA,EACrB,GAAA,EAAA,CAAM,EAAA,EAAI,EAAA,EAAA,EAAA,CAAO,EAAA,EAAI,EAAA,EAAA,EACrB,GAAA,EAAA,CAAM,EAAA,EAAI,EAAA,EAAA,EAAA,CAAO,EAAA,EAAI,EAAA,EAAA,EACrB,GAAA,EAAA,CAAM,EAAA,EAAI,EAAA,EAAA,EAAA,CAAO,EAAA,EAAI,EAAA,EAAA,EACrB,GAAA,EAAA,CAAM,EAAA,EAAI,EAAA,EAAA,EAAA,CAAO,EAAA,EAAI,EAAA,CAAA,EAAA,EAAA,CAAA,CACrB,EAAA,EAAI,EAAA,EAAA,EAAA,CAAO,EAAA,EAAI,EAAA,EAAA,EAAA,CACd,EAAA,EAAI,EAAA,EAAA,EAAA,CAAO,EAAA,EAAI,EAAA,EAAA,EAAA,CACf,EAAA,EAAI,EAAA,EAAA,EAAA,CAAO,EAAA,EAAI,EAAA,EAAA,EAAA,CACf,EAAA,EAAI,EAAA,EAAA,EAAA,CAAO,EAAA,EAAI,EAAA,EAAA,EAAA,CACf,EAAA,EAAI,EAAA,EAAA,EAAA,CAAO,EAAA,EAAI,EAAA,EAAA,EAAA,CACf,EAAA,EAAI,EAAA,EAAA,EAAA,CAAO,EAAA,EAAI,EAAA,CAAA,CAAA;AAEpB,EAAA,OAAO,CAAA;AACT;AAGA,IAAO,cAAA,EAAQ,UAAA;ADvDf;AACE;AACA;AACF,iEAAC","file":"/home/runner/work/turf/turf/packages/turf-planepoint/dist/cjs/index.cjs","sourcesContent":[null,"import { Feature, Polygon } from \"geojson\";\nimport { getCoord, getGeom } from \"@turf/invariant\";\nimport { Coord } from \"@turf/helpers\";\n\n/**\n * Takes a triangular plane as a polygon and a point within that triangle, and\n * returns the z-value at that point.\n *\n * The Polygon should have properties `a`, `b`, and `c`\n * that define the values at its three corners. Alternatively, the z-values\n * of each triangle point can be provided by their respective 3rd coordinate\n * if their values are not provided as properties.\n *\n * @function\n * @param {Coord} point the Point for which a z-value will be calculated\n * @param {Feature<Polygon>} triangle a Polygon feature with three vertices\n * @returns {number} the z-value for `interpolatedPoint`\n * @example\n * const point = turf.point([-75.3221, 39.529]);\n * // \"a\", \"b\", and \"c\" values represent the values of the coordinates in order.\n * const triangle = turf.polygon([[\n * [-75.1221, 39.57],\n * [-75.58, 39.18],\n * [-75.97, 39.86],\n * [-75.1221, 39.57]\n * ]], {\n * \"a\": 11,\n * \"b\": 122,\n * \"c\": 44\n * });\n *\n * const zValue = turf.planepoint(point, triangle);\n * point.properties.zValue = zValue;\n *\n * //addToMap\n * const addToMap = [triangle, point];\n */\nfunction planepoint(\n point: Coord,\n triangle: Feature<Polygon> | Polygon\n): number {\n // Normalize input\n const coord = getCoord(point);\n const geom = getGeom(triangle);\n const coords = geom.coordinates;\n const outer = coords[0];\n if (outer.length < 4)\n throw new Error(\"OuterRing of a Polygon must have 4 or more Positions.\");\n const properties = (triangle.type === \"Feature\" && triangle.properties) || {};\n const a = properties.a;\n const b = properties.b;\n const c = properties.c;\n\n // Planepoint\n const x = coord[0];\n const y = coord[1];\n const x1 = outer[0][0];\n const y1 = outer[0][1];\n const z1 = a !== undefined ? a : outer[0][2];\n const x2 = outer[1][0];\n const y2 = outer[1][1];\n const z2 = b !== undefined ? b : outer[1][2];\n const x3 = outer[2][0];\n const y3 = outer[2][1];\n const z3 = c !== undefined ? c : outer[2][2];\n const z =\n (z3 * (x - x1) * (y - y2) +\n z1 * (x - x2) * (y - y3) +\n z2 * (x - x3) * (y - y1) -\n z2 * (x - x1) * (y - y3) -\n z3 * (x - x2) * (y - y1) -\n z1 * (x - x3) * (y - y2)) /\n ((x - x1) * (y - y2) +\n (x - x2) * (y - y3) +\n (x - x3) * (y - y1) -\n (x - x1) * (y - y3) -\n (x - x2) * (y - y1) -\n (x - x3) * (y - y2));\n\n return z;\n}\n\nexport { planepoint };\nexport default planepoint;\n"]}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -10,7 +10,7 @@ import { Coord } from '@turf/helpers';
|
|
|
10
10
|
* of each triangle point can be provided by their respective 3rd coordinate
|
|
11
11
|
* if their values are not provided as properties.
|
|
12
12
|
*
|
|
13
|
-
* @
|
|
13
|
+
* @function
|
|
14
14
|
* @param {Coord} point the Point for which a z-value will be calculated
|
|
15
15
|
* @param {Feature<Polygon>} triangle a Polygon feature with three vertices
|
|
16
16
|
* @returns {number} the z-value for `interpolatedPoint`
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { Coord } from '@turf/helpers';
|
|
|
10
10
|
* of each triangle point can be provided by their respective 3rd coordinate
|
|
11
11
|
* if their values are not provided as properties.
|
|
12
12
|
*
|
|
13
|
-
* @
|
|
13
|
+
* @function
|
|
14
14
|
* @param {Coord} point the Point for which a z-value will be calculated
|
|
15
15
|
* @param {Feature<Polygon>} triangle a Polygon feature with three vertices
|
|
16
16
|
* @returns {number} the z-value for `interpolatedPoint`
|
package/dist/esm/index.js
CHANGED
|
@@ -25,9 +25,9 @@ function planepoint(point, triangle) {
|
|
|
25
25
|
const z = (z3 * (x - x1) * (y - y2) + z1 * (x - x2) * (y - y3) + z2 * (x - x3) * (y - y1) - z2 * (x - x1) * (y - y3) - z3 * (x - x2) * (y - y1) - z1 * (x - x3) * (y - y2)) / ((x - x1) * (y - y2) + (x - x2) * (y - y3) + (x - x3) * (y - y1) - (x - x1) * (y - y3) - (x - x2) * (y - y1) - (x - x3) * (y - y2));
|
|
26
26
|
return z;
|
|
27
27
|
}
|
|
28
|
-
var
|
|
28
|
+
var index_default = planepoint;
|
|
29
29
|
export {
|
|
30
|
-
|
|
30
|
+
index_default as default,
|
|
31
31
|
planepoint
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, Polygon } from \"geojson\";\nimport { getCoord, getGeom } from \"@turf/invariant\";\nimport { Coord } from \"@turf/helpers\";\n\n/**\n * Takes a triangular plane as a polygon and a point within that triangle, and\n * returns the z-value at that point.\n *\n * The Polygon should have properties `a`, `b`, and `c`\n * that define the values at its three corners. Alternatively, the z-values\n * of each triangle point can be provided by their respective 3rd coordinate\n * if their values are not provided as properties.\n *\n * @
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, Polygon } from \"geojson\";\nimport { getCoord, getGeom } from \"@turf/invariant\";\nimport { Coord } from \"@turf/helpers\";\n\n/**\n * Takes a triangular plane as a polygon and a point within that triangle, and\n * returns the z-value at that point.\n *\n * The Polygon should have properties `a`, `b`, and `c`\n * that define the values at its three corners. Alternatively, the z-values\n * of each triangle point can be provided by their respective 3rd coordinate\n * if their values are not provided as properties.\n *\n * @function\n * @param {Coord} point the Point for which a z-value will be calculated\n * @param {Feature<Polygon>} triangle a Polygon feature with three vertices\n * @returns {number} the z-value for `interpolatedPoint`\n * @example\n * const point = turf.point([-75.3221, 39.529]);\n * // \"a\", \"b\", and \"c\" values represent the values of the coordinates in order.\n * const triangle = turf.polygon([[\n * [-75.1221, 39.57],\n * [-75.58, 39.18],\n * [-75.97, 39.86],\n * [-75.1221, 39.57]\n * ]], {\n * \"a\": 11,\n * \"b\": 122,\n * \"c\": 44\n * });\n *\n * const zValue = turf.planepoint(point, triangle);\n * point.properties.zValue = zValue;\n *\n * //addToMap\n * const addToMap = [triangle, point];\n */\nfunction planepoint(\n point: Coord,\n triangle: Feature<Polygon> | Polygon\n): number {\n // Normalize input\n const coord = getCoord(point);\n const geom = getGeom(triangle);\n const coords = geom.coordinates;\n const outer = coords[0];\n if (outer.length < 4)\n throw new Error(\"OuterRing of a Polygon must have 4 or more Positions.\");\n const properties = (triangle.type === \"Feature\" && triangle.properties) || {};\n const a = properties.a;\n const b = properties.b;\n const c = properties.c;\n\n // Planepoint\n const x = coord[0];\n const y = coord[1];\n const x1 = outer[0][0];\n const y1 = outer[0][1];\n const z1 = a !== undefined ? a : outer[0][2];\n const x2 = outer[1][0];\n const y2 = outer[1][1];\n const z2 = b !== undefined ? b : outer[1][2];\n const x3 = outer[2][0];\n const y3 = outer[2][1];\n const z3 = c !== undefined ? c : outer[2][2];\n const z =\n (z3 * (x - x1) * (y - y2) +\n z1 * (x - x2) * (y - y3) +\n z2 * (x - x3) * (y - y1) -\n z2 * (x - x1) * (y - y3) -\n z3 * (x - x2) * (y - y1) -\n z1 * (x - x3) * (y - y2)) /\n ((x - x1) * (y - y2) +\n (x - x2) * (y - y3) +\n (x - x3) * (y - y1) -\n (x - x1) * (y - y3) -\n (x - x2) * (y - y1) -\n (x - x3) * (y - y2));\n\n return z;\n}\n\nexport { planepoint };\nexport default planepoint;\n"],"mappings":";AACA,SAAS,UAAU,eAAe;AAoClC,SAAS,WACP,OACA,UACQ;AAER,QAAM,QAAQ,SAAS,KAAK;AAC5B,QAAM,OAAO,QAAQ,QAAQ;AAC7B,QAAM,SAAS,KAAK;AACpB,QAAM,QAAQ,OAAO,CAAC;AACtB,MAAI,MAAM,SAAS;AACjB,UAAM,IAAI,MAAM,uDAAuD;AACzE,QAAM,aAAc,SAAS,SAAS,aAAa,SAAS,cAAe,CAAC;AAC5E,QAAM,IAAI,WAAW;AACrB,QAAM,IAAI,WAAW;AACrB,QAAM,IAAI,WAAW;AAGrB,QAAM,IAAI,MAAM,CAAC;AACjB,QAAM,IAAI,MAAM,CAAC;AACjB,QAAM,KAAK,MAAM,CAAC,EAAE,CAAC;AACrB,QAAM,KAAK,MAAM,CAAC,EAAE,CAAC;AACrB,QAAM,KAAK,MAAM,SAAY,IAAI,MAAM,CAAC,EAAE,CAAC;AAC3C,QAAM,KAAK,MAAM,CAAC,EAAE,CAAC;AACrB,QAAM,KAAK,MAAM,CAAC,EAAE,CAAC;AACrB,QAAM,KAAK,MAAM,SAAY,IAAI,MAAM,CAAC,EAAE,CAAC;AAC3C,QAAM,KAAK,MAAM,CAAC,EAAE,CAAC;AACrB,QAAM,KAAK,MAAM,CAAC,EAAE,CAAC;AACrB,QAAM,KAAK,MAAM,SAAY,IAAI,MAAM,CAAC,EAAE,CAAC;AAC3C,QAAM,KACH,MAAM,IAAI,OAAO,IAAI,MACpB,MAAM,IAAI,OAAO,IAAI,MACrB,MAAM,IAAI,OAAO,IAAI,MACrB,MAAM,IAAI,OAAO,IAAI,MACrB,MAAM,IAAI,OAAO,IAAI,MACrB,MAAM,IAAI,OAAO,IAAI,SACrB,IAAI,OAAO,IAAI,OACd,IAAI,OAAO,IAAI,OACf,IAAI,OAAO,IAAI,OACf,IAAI,OAAO,IAAI,OACf,IAAI,OAAO,IAAI,OACf,IAAI,OAAO,IAAI;AAEpB,SAAO;AACT;AAGA,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/planepoint",
|
|
3
|
-
"version": "7.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.3.0",
|
|
4
|
+
"description": "Takes a triangular plane as a polygon and a point within that triangle, and returns the z-value at that point.",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bugs": {
|
|
@@ -54,19 +54,19 @@
|
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/benchmark": "^2.1.5",
|
|
57
|
-
"@types/tape": "^
|
|
57
|
+
"@types/tape": "^5.8.1",
|
|
58
58
|
"benchmark": "^2.1.4",
|
|
59
59
|
"npm-run-all": "^4.1.5",
|
|
60
|
-
"tape": "^5.
|
|
61
|
-
"tsup": "^8.0
|
|
62
|
-
"tsx": "^4.
|
|
63
|
-
"typescript": "^5.
|
|
60
|
+
"tape": "^5.9.0",
|
|
61
|
+
"tsup": "^8.4.0",
|
|
62
|
+
"tsx": "^4.19.4",
|
|
63
|
+
"typescript": "^5.8.3"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@turf/helpers": "
|
|
67
|
-
"@turf/invariant": "
|
|
66
|
+
"@turf/helpers": "7.3.0",
|
|
67
|
+
"@turf/invariant": "7.3.0",
|
|
68
68
|
"@types/geojson": "^7946.0.10",
|
|
69
|
-
"tslib": "^2.
|
|
69
|
+
"tslib": "^2.8.1"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "9f58a103e8f9a587ab640307ed03ba5233913ddd"
|
|
72
72
|
}
|