@turf/planepoint 7.0.0 → 7.1.0-alpha.7
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 +1 -5
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// index.js
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.js
|
|
5
2
|
var _invariant = require('@turf/invariant');
|
|
6
3
|
function planepoint(point, triangle) {
|
|
7
4
|
var coord = _invariant.getCoord.call(void 0, point);
|
|
@@ -28,7 +25,6 @@ function planepoint(point, triangle) {
|
|
|
28
25
|
var 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));
|
|
29
26
|
return z;
|
|
30
27
|
}
|
|
31
|
-
__name(planepoint, "planepoint");
|
|
32
28
|
var turf_planepoint_default = planepoint;
|
|
33
29
|
|
|
34
30
|
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../index.js"],"names":[],"mappings":";AAAA,SAAS,UAAU,eAAe;AAkClC,SAAS,WAAW,OAAO,UAAU;AAEnC,MAAI,QAAQ,SAAS,KAAK;AAC1B,MAAI,OAAO,QAAQ,QAAQ;AAC3B,MAAI,SAAS,KAAK;AAClB,MAAI,QAAQ,OAAO,CAAC;AACpB,MAAI,MAAM,SAAS;AACjB,UAAM,IAAI,MAAM,uDAAuD;AACzE,MAAI,aAAa,SAAS,cAAc,CAAC;AACzC,MAAI,IAAI,WAAW;AACnB,MAAI,IAAI,WAAW;AACnB,MAAI,IAAI,WAAW;AAGnB,MAAI,IAAI,MAAM,CAAC;AACf,MAAI,IAAI,MAAM,CAAC;AACf,MAAI,KAAK,MAAM,CAAC,EAAE,CAAC;AACnB,MAAI,KAAK,MAAM,CAAC,EAAE,CAAC;AACnB,MAAI,KAAK,MAAM,SAAY,IAAI,MAAM,CAAC,EAAE,CAAC;AACzC,MAAI,KAAK,MAAM,CAAC,EAAE,CAAC;AACnB,MAAI,KAAK,MAAM,CAAC,EAAE,CAAC;AACnB,MAAI,KAAK,MAAM,SAAY,IAAI,MAAM,CAAC,EAAE,CAAC;AACzC,MAAI,KAAK,MAAM,CAAC,EAAE,CAAC;AACnB,MAAI,KAAK,MAAM,CAAC,EAAE,CAAC;AACnB,MAAI,KAAK,MAAM,SAAY,IAAI,MAAM,CAAC,EAAE,CAAC;AACzC,MAAI,KACD,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,0BAAQ","sourcesContent":["import { getCoord, getGeom } from \"@turf/invariant\";\n\n/**\n * Takes a triangular plane as a {@link Polygon}\n * and a {@link Point} within that triangle and returns the z-value\n * at that point. 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 * @name planepoint\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 * var point = turf.point([-75.3221, 39.529]);\n * // \"a\", \"b\", and \"c\" values represent the values of the coordinates in order.\n * var 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 * var zValue = turf.planepoint(point, triangle);\n * point.properties.zValue = zValue;\n *\n * //addToMap\n * var addToMap = [triangle, point];\n */\nfunction planepoint(point, triangle) {\n // Normalize input\n var coord = getCoord(point);\n var geom = getGeom(triangle);\n var coords = geom.coordinates;\n var outer = coords[0];\n if (outer.length < 4)\n throw new Error(\"OuterRing of a Polygon must have 4 or more Positions.\");\n var properties = triangle.properties || {};\n var a = properties.a;\n var b = properties.b;\n var c = properties.c;\n\n // Planepoint\n var x = coord[0];\n var y = coord[1];\n var x1 = outer[0][0];\n var y1 = outer[0][1];\n var z1 = a !== undefined ? a : outer[0][2];\n var x2 = outer[1][0];\n var y2 = outer[1][1];\n var z2 = b !== undefined ? b : outer[1][2];\n var x3 = outer[2][0];\n var y3 = outer[2][1];\n var z3 = c !== undefined ? c : outer[2][2];\n var 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/esm/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// index.js
|
|
5
2
|
import { getCoord, getGeom } from "@turf/invariant";
|
|
6
3
|
function planepoint(point, triangle) {
|
|
@@ -28,7 +25,6 @@ function planepoint(point, triangle) {
|
|
|
28
25
|
var 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));
|
|
29
26
|
return z;
|
|
30
27
|
}
|
|
31
|
-
__name(planepoint, "planepoint");
|
|
32
28
|
var turf_planepoint_default = planepoint;
|
|
33
29
|
export {
|
|
34
30
|
turf_planepoint_default as default,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.js"],"sourcesContent":["import { getCoord, getGeom } from \"@turf/invariant\";\n\n/**\n * Takes a triangular plane as a {@link Polygon}\n * and a {@link Point} within that triangle and returns the z-value\n * at that point. 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 * @name planepoint\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 * var point = turf.point([-75.3221, 39.529]);\n * // \"a\", \"b\", and \"c\" values represent the values of the coordinates in order.\n * var 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 * var zValue = turf.planepoint(point, triangle);\n * point.properties.zValue = zValue;\n *\n * //addToMap\n * var addToMap = [triangle, point];\n */\nfunction planepoint(point, triangle) {\n // Normalize input\n var coord = getCoord(point);\n var geom = getGeom(triangle);\n var coords = geom.coordinates;\n var outer = coords[0];\n if (outer.length < 4)\n throw new Error(\"OuterRing of a Polygon must have 4 or more Positions.\");\n var properties = triangle.properties || {};\n var a = properties.a;\n var b = properties.b;\n var c = properties.c;\n\n // Planepoint\n var x = coord[0];\n var y = coord[1];\n var x1 = outer[0][0];\n var y1 = outer[0][1];\n var z1 = a !== undefined ? a : outer[0][2];\n var x2 = outer[1][0];\n var y2 = outer[1][1];\n var z2 = b !== undefined ? b : outer[1][2];\n var x3 = outer[2][0];\n var y3 = outer[2][1];\n var z3 = c !== undefined ? c : outer[2][2];\n var 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":"
|
|
1
|
+
{"version":3,"sources":["../../index.js"],"sourcesContent":["import { getCoord, getGeom } from \"@turf/invariant\";\n\n/**\n * Takes a triangular plane as a {@link Polygon}\n * and a {@link Point} within that triangle and returns the z-value\n * at that point. 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 * @name planepoint\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 * var point = turf.point([-75.3221, 39.529]);\n * // \"a\", \"b\", and \"c\" values represent the values of the coordinates in order.\n * var 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 * var zValue = turf.planepoint(point, triangle);\n * point.properties.zValue = zValue;\n *\n * //addToMap\n * var addToMap = [triangle, point];\n */\nfunction planepoint(point, triangle) {\n // Normalize input\n var coord = getCoord(point);\n var geom = getGeom(triangle);\n var coords = geom.coordinates;\n var outer = coords[0];\n if (outer.length < 4)\n throw new Error(\"OuterRing of a Polygon must have 4 or more Positions.\");\n var properties = triangle.properties || {};\n var a = properties.a;\n var b = properties.b;\n var c = properties.c;\n\n // Planepoint\n var x = coord[0];\n var y = coord[1];\n var x1 = outer[0][0];\n var y1 = outer[0][1];\n var z1 = a !== undefined ? a : outer[0][2];\n var x2 = outer[1][0];\n var y2 = outer[1][1];\n var z2 = b !== undefined ? b : outer[1][2];\n var x3 = outer[2][0];\n var y3 = outer[2][1];\n var z3 = c !== undefined ? c : outer[2][2];\n var 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":";AAAA,SAAS,UAAU,eAAe;AAkClC,SAAS,WAAW,OAAO,UAAU;AAEnC,MAAI,QAAQ,SAAS,KAAK;AAC1B,MAAI,OAAO,QAAQ,QAAQ;AAC3B,MAAI,SAAS,KAAK;AAClB,MAAI,QAAQ,OAAO,CAAC;AACpB,MAAI,MAAM,SAAS;AACjB,UAAM,IAAI,MAAM,uDAAuD;AACzE,MAAI,aAAa,SAAS,cAAc,CAAC;AACzC,MAAI,IAAI,WAAW;AACnB,MAAI,IAAI,WAAW;AACnB,MAAI,IAAI,WAAW;AAGnB,MAAI,IAAI,MAAM,CAAC;AACf,MAAI,IAAI,MAAM,CAAC;AACf,MAAI,KAAK,MAAM,CAAC,EAAE,CAAC;AACnB,MAAI,KAAK,MAAM,CAAC,EAAE,CAAC;AACnB,MAAI,KAAK,MAAM,SAAY,IAAI,MAAM,CAAC,EAAE,CAAC;AACzC,MAAI,KAAK,MAAM,CAAC,EAAE,CAAC;AACnB,MAAI,KAAK,MAAM,CAAC,EAAE,CAAC;AACnB,MAAI,KAAK,MAAM,SAAY,IAAI,MAAM,CAAC,EAAE,CAAC;AACzC,MAAI,KAAK,MAAM,CAAC,EAAE,CAAC;AACnB,MAAI,KAAK,MAAM,CAAC,EAAE,CAAC;AACnB,MAAI,KAAK,MAAM,SAAY,IAAI,MAAM,CAAC,EAAE,CAAC;AACzC,MAAI,KACD,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,0BAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/planepoint",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.1.0-alpha.7+0ce6ecca0",
|
|
4
4
|
"description": "turf planepoint module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"tsx": "^4.6.2"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@turf/helpers": "^7.0.
|
|
64
|
-
"@turf/invariant": "^7.0.
|
|
63
|
+
"@turf/helpers": "^7.1.0-alpha.7+0ce6ecca0",
|
|
64
|
+
"@turf/invariant": "^7.1.0-alpha.7+0ce6ecca0"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "0ce6ecca05829690270fec6d6bed2003495fe0ea"
|
|
67
67
|
}
|