{"_id":"2d-bicubic-interpolate","_rev":"8-1edf141f3345afd001bfacc549f51733","name":"2d-bicubic-interpolate","description":"Interpolate data set representing function of two variables z = f(x,y) with bicubic spline","dist-tags":{"latest":"1.0.7"},"versions":{"1.0.0":{"name":"2d-bicubic-interpolate","version":"1.0.0","description":"Interpolate data set representing function of two variables z = f(x,y) with bicubic spline","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/jablpiotrek/2d-bicubic-interpolate.git"},"keywords":["bicubic","interpolation","array","2d"],"author":{"name":"Piotr Jablonski"},"license":"MIT","bugs":{"url":"https://github.com/jablpiotrek/2d-bicubic-interpolate/issues"},"homepage":"https://github.com/jablpiotrek/2d-bicubic-interpolate#readme","gitHead":"d707085453923d5157a8ab90c0c047fdd78237a1","_id":"2d-bicubic-interpolate@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.5.0","_npmUser":{"name":"jablpiotrek","email":"jabl.piotrek@gmail.com"},"dist":{"integrity":"sha512-D0SQvHBiYyPoD1L7fWniqreY+CXcYCyPAmkTharLD9UOXesy4LOvHFqU7CZ1ahE85SYSaaoTt2sZDkh+KjbXgA==","shasum":"f1cc5e830a47173ddae4bf370dd7c82d85288a9b","tarball":"https://registry.npmjs.org/2d-bicubic-interpolate/-/2d-bicubic-interpolate-1.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEfkUWJNMf8mBM2BqQOAvM9XxuMVqd1q9LK8PwhdCbj0AiEAoHnW4dlKg/G4RL51Mc0zxOuI7M4ihdvZlXWCEv5fCrQ="}]},"maintainers":[{"name":"jablpiotrek","email":"jabl.piotrek@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2d-bicubic-interpolate-1.0.0.tgz_1514849157730_0.761962613556534"},"directories":{}},"1.0.1":{"name":"2d-bicubic-interpolate","version":"1.0.1","description":"Interpolate data set representing function of two variables z = f(x,y) with bicubic spline","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/jablpiotrek/2d-bicubic-interpolate.git"},"keywords":["bicubic","interpolation","array","2d"],"author":{"name":"Piotr Jablonski"},"license":"MIT","bugs":{"url":"https://github.com/jablpiotrek/2d-bicubic-interpolate/issues"},"homepage":"https://github.com/jablpiotrek/2d-bicubic-interpolate#readme","dependancies":{"cubic-spline":"^1.0.4","split-array":"^1.0.1"},"gitHead":"637c9014f42c5949eea7690b289adb1efc8c0713","_id":"2d-bicubic-interpolate@1.0.1","_npmVersion":"5.6.0","_nodeVersion":"8.5.0","_npmUser":{"name":"jablpiotrek","email":"jabl.piotrek@gmail.com"},"dist":{"integrity":"sha512-8Lp0Ar5uTYXtBfkpX4QgayWZXeg+bGhRLnrMk2+DuYpmjzfmiVwPyRWn7C71ezaCu8bqrFc9BNJPyvTwXNNI+Q==","shasum":"0754ff718924d9cb4c912f658636e2f0eae85cf1","tarball":"https://registry.npmjs.org/2d-bicubic-interpolate/-/2d-bicubic-interpolate-1.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+gaMpQ1xBbPBaJt/AKUVQFirDNi2Okh29icYXtXnA6wIhAMZDC4TZhbem088He2/mjRoXwJSpoemMcFdi4uXY3vbb"}]},"maintainers":[{"name":"jablpiotrek","email":"jabl.piotrek@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2d-bicubic-interpolate-1.0.1.tgz_1514860993493_0.03323865751735866"},"directories":{}},"1.0.2":{"name":"2d-bicubic-interpolate","version":"1.0.2","description":"Interpolate data set representing function of two variables z = f(x,y) with bicubic spline","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/jablpiotrek/2d-bicubic-interpolate.git"},"keywords":["bicubic","interpolation","array","2d"],"author":{"name":"Piotr Jablonski"},"license":"MIT","bugs":{"url":"https://github.com/jablpiotrek/2d-bicubic-interpolate/issues"},"homepage":"https://github.com/jablpiotrek/2d-bicubic-interpolate#readme","dependencies":{"cubic-spline":"^1.0.4","split-array":"^1.0.1"},"gitHead":"7df16267e734e6ad33efc584fa794275b19ba740","_id":"2d-bicubic-interpolate@1.0.2","_npmVersion":"5.6.0","_nodeVersion":"8.5.0","_npmUser":{"name":"jablpiotrek","email":"jabl.piotrek@gmail.com"},"dist":{"integrity":"sha512-EnNhcCXBKb+Q//zkO0LGaWSwyWfuowX1HSeC32tNKqh+c+C9le+TG3qD+FKOoa7aKfFMvvZUTJ6ene8u9OYLOQ==","shasum":"bf84fd0a1dc6c520888c69c2db912e55d7ad0ca7","tarball":"https://registry.npmjs.org/2d-bicubic-interpolate/-/2d-bicubic-interpolate-1.0.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA7hG4cjLNK1ANl/y1Q5kSHNRvnSPUUt3PExjsIMqjzRAiAywoMOfmkaRn+d+GU8ij3byV0TiS5gMZEGL9+Kulequw=="}]},"maintainers":[{"name":"jablpiotrek","email":"jabl.piotrek@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2d-bicubic-interpolate-1.0.2.tgz_1514861448637_0.11797463288530707"},"directories":{}},"1.0.3":{"name":"2d-bicubic-interpolate","version":"1.0.3","description":"Interpolate data set representing function of two variables z = f(x,y) with bicubic spline","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/jablpiotrek/2d-bicubic-interpolate.git"},"keywords":["bicubic","interpolation","array","2d"],"author":{"name":"Piotr Jablonski"},"license":"MIT","bugs":{"url":"https://github.com/jablpiotrek/2d-bicubic-interpolate/issues"},"homepage":"https://github.com/jablpiotrek/2d-bicubic-interpolate#readme","dependencies":{"cubic-spline":"^1.0.4","split-array":"^1.0.1"},"gitHead":"9568390dc5531bde3c8590d8dfa65982ef00169f","_id":"2d-bicubic-interpolate@1.0.3","_npmVersion":"5.6.0","_nodeVersion":"8.5.0","_npmUser":{"name":"jablpiotrek","email":"jabl.piotrek@gmail.com"},"dist":{"integrity":"sha512-rmZhYBBvyseogyNIuSrMXtVOdpzDol1TRc1MuxV/U8++Rh/HFtIUeGuoQwwFJnUbjgE4I4+C3dLAj5JWXiLX9A==","shasum":"9892276a3cfe261addade4f58ec9dce5cb02f520","tarball":"https://registry.npmjs.org/2d-bicubic-interpolate/-/2d-bicubic-interpolate-1.0.3.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC9GX0gej5JORPAXH2vDjENCd3ZWCQ5WE+lgwKvuPVeJAIgBYP3tZQpSR9wz/H9guWbghZWfOzjZO2yh2Kwz/PH1z0="}]},"maintainers":[{"name":"jablpiotrek","email":"jabl.piotrek@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2d-bicubic-interpolate-1.0.3.tgz_1514967225370_0.28918148041702807"},"directories":{}},"1.0.5":{"name":"2d-bicubic-interpolate","version":"1.0.5","description":"Interpolate data set representing function of two variables z = f(x,y) with bicubic spline","main":"index.js","scripts":{"test":"mocha *.test.js"},"repository":{"type":"git","url":"git+https://github.com/jablpiotrek/2d-bicubic-interpolate.git"},"keywords":["bicubic","interpolation","array","2d"],"author":{"name":"Piotr Jablonski"},"license":"MIT","bugs":{"url":"https://github.com/jablpiotrek/2d-bicubic-interpolate/issues"},"homepage":"https://github.com/jablpiotrek/2d-bicubic-interpolate#readme","dependencies":{"cubic-spline":"^1.0.4","split-array":"^1.0.1"},"devDependencies":{"chai":"^4.1.2","mocha":"^5.0.5"},"gitHead":"ff35d03b53427eb77b88305d8cb539f4d3a1277c","_id":"2d-bicubic-interpolate@1.0.5","_npmVersion":"5.7.1","_nodeVersion":"8.5.0","_npmUser":{"name":"jablpiotrek","email":"jabl.piotrek@gmail.com"},"dist":{"integrity":"sha512-Oit8i87CZLAdb4n6ap8B7C99hFmpXc99UNl1tAIDhQQzuU4LKvm6+zNXhYhqK0NOJGsSRIiu1q3HclivasGhrQ==","shasum":"c822d384c698403d1d6a6a538225dfee36035b06","tarball":"https://registry.npmjs.org/2d-bicubic-interpolate/-/2d-bicubic-interpolate-1.0.5.tgz","fileCount":6,"unpackedSize":10627,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDVE4O5GyBTya8bfo02K/9jPy37hsdgD8SmUFVO6glovAiEA61jYWZzmJuEnigPpTdS0aNGqWIKyf4aUnOdvJT14IZ4="}]},"maintainers":[{"name":"jablpiotrek","email":"jabl.piotrek@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2d-bicubic-interpolate_1.0.5_1521880885656_0.5590141591118369"},"_hasShrinkwrap":false},"1.0.6":{"name":"2d-bicubic-interpolate","version":"1.0.6","description":"Interpolate data set representing function of two variables z = f(x,y) with bicubic spline","main":"index.js","scripts":{"test":"mocha *.test.js"},"repository":{"type":"git","url":"git+https://github.com/jablpiotrek/2d-bicubic-interpolate.git"},"keywords":["bicubic","interpolation","array","2d"],"author":{"name":"Piotr Jablonski"},"license":"MIT","bugs":{"url":"https://github.com/jablpiotrek/2d-bicubic-interpolate/issues"},"homepage":"https://github.com/jablpiotrek/2d-bicubic-interpolate#readme","dependencies":{"cubic-spline":"^1.0.4","split-array":"^1.0.1"},"devDependencies":{"chai":"^4.1.2","mocha":"^5.0.5"},"gitHead":"06bfb74b4f752e16b38988b3a6748b1aa8ae7b41","_id":"2d-bicubic-interpolate@1.0.6","_npmVersion":"5.7.1","_nodeVersion":"8.5.0","_npmUser":{"name":"jablpiotrek","email":"jabl.piotrek@gmail.com"},"dist":{"integrity":"sha512-31XRafaeLPtbBu9jWSBfTPD+HZv1U0KASqj+ddzndWzHQUaoIxyzg2+1mDv9ypuMXtD4czEzZhe7Fb816+tLMQ==","shasum":"45672e0ef86ec16926e5300c93b4a64bc88fbeaf","tarball":"https://registry.npmjs.org/2d-bicubic-interpolate/-/2d-bicubic-interpolate-1.0.6.tgz","fileCount":6,"unpackedSize":10747,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC3D77dC5mbYajVcyUz8Hn+2QN/M2PWaZ8bWV1oMcka6AiEAmju8Ox87PtrUvH2uTKEnNhErldMgMoo7h3QShR42VmI="}]},"maintainers":[{"name":"jablpiotrek","email":"jabl.piotrek@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2d-bicubic-interpolate_1.0.6_1521941479575_0.4989741717702483"},"_hasShrinkwrap":false},"1.0.7":{"name":"2d-bicubic-interpolate","version":"1.0.7","description":"Interpolate data set representing function of two variables z = f(x,y) with bicubic spline","main":"index.js","scripts":{"test":"mocha *.test.js"},"repository":{"type":"git","url":"git+https://github.com/jablpiotrek/2d-bicubic-interpolate.git"},"keywords":["bicubic","interpolation","array","2d"],"author":{"name":"Piotr Jablonski"},"license":"MIT","bugs":{"url":"https://github.com/jablpiotrek/2d-bicubic-interpolate/issues"},"homepage":"https://github.com/jablpiotrek/2d-bicubic-interpolate#readme","dependencies":{"cubic-spline":"^1.0.4","split-array":"^1.0.1"},"devDependencies":{"chai":"^4.1.2","mocha":"^5.1.0"},"gitHead":"3821d47bd3fda6294dcdaf79a71bdc4191dad341","_id":"2d-bicubic-interpolate@1.0.7","_npmVersion":"5.8.0","_nodeVersion":"8.5.0","_npmUser":{"name":"jablpiotrek","email":"jabl.piotrek@gmail.com"},"dist":{"integrity":"sha512-B7IRBSRcrxKRx+1LZ7CGZ6vFKpts4A24fza14z/lPqSz5YNr4sDVsC+SSkQLDPf/4DanArJqZ5AXrZW0lrtnag==","shasum":"73c5c80cd064bc319b8f547a994231bfecc6582a","tarball":"https://registry.npmjs.org/2d-bicubic-interpolate/-/2d-bicubic-interpolate-1.0.7.tgz","fileCount":6,"unpackedSize":11095,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa0/6VCRA9TVsSAnZWagAABDkP/3HB1byNS7KkRWMNg6as\n1a1Fub/5Qs+isfII7/Oijvt0mWQPGYRVsS7VTMV4l53j7WaLyafG9/uAhptc\nrTXltCmIlHM6r81EbGzmCRmztaP0of/Ut9wqb/t4INCoHwgtpU7KIWPZehnP\nSh5GxHSp4oSDRfam58Gm5nxGYRrkKjUVuffH5V+LoVLKnDzSAcVn6KClI9cS\nb1j9K6I2faBg6ThtnUBFHgPpIm/mE0DrfDXxuVc/oyfWoTV9wflaq2nd6FEw\n6zmITqgVxDdzfjkPvRs+qGnQgBRbr+MdqzKdJ43soO6XNCA57j15H3jCRAhm\nbu05FyHFX0bFClDu3As5EWM19VwveCCESMrdSqMouaq+AHC3BaEZk2ImBBE3\nk4QLXzbhwDnl6kTmxe3+UJh6UV1cy31FzxqCZyhHamfed9ZaX5m5H8D8w0En\ndOxunTMUqAraEHgvKWy/uYASCc+t9FT6CRf7rdF9nrP4fae1ma7TxW8bW5XC\n86VnfCQpMHttpNAvYmCqQEgy0+bYCZmH+znFI1cIFRkLu88QhVAvSD6oR7DO\nKi8dE6JsfRIX7+3Gf9/HpNoyDShrBCD64K8AKvwXlu5o9ETP/F0CIbhDEMY/\n2oUc43aS2YzGhcmwWV2ars9LmVUGqufWnk7ggYNMvJ23T4HExRxA0558KDhE\nbibq\r\n=RC7x\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5sihOohk1stNl6ymdPAJlxC4nZqYdU5k+Dh9+rB5s8AIgZziDzM9HfvO3f/HhFEPA71ZsHYC/iOItI1vjFWeVxC4="}]},"maintainers":[{"name":"jablpiotrek","email":"jabl.piotrek@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2d-bicubic-interpolate_1.0.7_1523842708426_0.7062767740863487"},"_hasShrinkwrap":false}},"readme":"# 2d-bicubic-interpolate\r\n\r\n## Ver. 1.0.7\r\n\r\nThis version includes contribution of [Akshat Khare](https://github.com/akshat-khare). According to Akshat pull request: \r\n\r\n```\r\nPreviously the code failed for matrices with repeated value of z for\r\ndifferent record, which is undesired, so changed the code to accomodate\r\nthat issue.\r\n```\r\n\r\n## Description\r\n\r\nThis package is a simple implementation of a [cubic-spline](https://www.npmjs.com/package/cubic-spline) by [morganherlocker](https://www.npmjs.com/~morganherlocker) for two-directional interpolation (2-dimensional arrays).  \r\nAssumed purpose of this package is to interpolate *discrete function* of two variables (e.g., for a surface plot).\r\n```\r\nz = f(x,y)\r\n```\r\n\r\nFollowing package was developed for [another project](https://github.com/jablpiotrek/Contact-stress) that utilizes it for surface plot interpolation.\r\n## Dependencies\r\n\r\nPackage runs thanks to two dependencies. Firstly, of course  [cubic-spline](https://www.npmjs.com/package/cubic-spline) by [morganherlocker](https://www.npmjs.com/~morganherlocker) must be included. Another little package needed to run 2d-bicubic-spline is [split-array](https://www.npmjs.com/package/split-array) by [Arthur Verschaeve](https://www.npmjs.com/~arthurvr). Development dependencies fot testing include Mocha & Chai.\r\n\r\n## Install\r\n\r\nTo install package:\r\n```\r\nnpm install --save 2d-bicubic-interpolate\r\n```\r\n\r\n## Include in your project\r\n\r\n```javascript\r\nimport interpolateArray from '2d-bicubic-interpolate';\r\n```\r\n## API\r\n### interpolateArray(data, n);\r\nFunction takes two parameters: data, including data set to interpolate, and parameter n that describes 'strength' of interpolation.\r\nFunction returns interpolated data set.\r\n\r\n### *data*\r\nData set is expected to be representation of a [discrete function](https://mathbitsnotebook.com/Algebra1/FunctionGraphs/FNGContinuousDiscrete.html) of [two variables](https://en.wikipedia.org/wiki/Function_of_several_real_variables). Data set is expected to be an array of objects, where every each object presents coordinates for each point of function. Coordinates values are expected to be real numbers. \r\n\r\n```javascript\r\nconst data = [\r\n    {\r\n        x: 0, \r\n        y: 0, \r\n        z: 2\r\n    },\r\n    {\r\n        x: 1, \r\n        y: 0, \r\n        z: 0.3\r\n    },\r\n    {\r\n        x: 0, \r\n        y: 1, \r\n        z: 1.4\r\n    },\r\n    {\r\n        x: 1, \r\n        y: 1, \r\n        z: 2.5\r\n    }\r\n]\r\n```\r\n\r\n### *n* parameter -  the interpolation factor\r\n\r\nInterpolation factor, the n parameter need to be a positive integer or 0. This number describes how many new points are going to be put between primary points. E.g., for n = 4, between every 2 primary points from input data, four new points are going to be calculated and inserted between. For n = 0, no interpolation is applied and output is the same as input.  \r\n\r\n### Output\r\n\r\nFunction **interpolateArray** returns new data set, which has the same structure as an input. Length of new data array is described as:\r\n```\r\nL1 = L0 + (L0 - 1) * n\r\n```\r\nWhere:  \r\nL1 -  length of output array  \r\nL0 - length of input array  \r\nn - interpolation factor\r\n\r\n## Examples\r\n### Example 1\r\n```javascript\r\nimport interpolateArray from '2d-bicubic-interpolate';\r\nconst data = [\r\n    {\r\n        x: 0,\r\n        y: 0,\r\n        z: 0.3\r\n    },\r\n    {\r\n        x: 1,\r\n        y: 0,\r\n        z: 1.2\r\n    },\r\n    {\r\n        x: 0,\r\n        y: 1,\r\n        z: 1.4\r\n    },\r\n    {\r\n        x: 1,\r\n        y: 1,\r\n        z: 2.2\r\n    }\r\n];\r\n\r\nconsole.log(interpolateArray(data, 1));\r\n\r\n/*\r\nconsole: \r\n\r\n(9) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]\r\n0:{x: 0, y: 0, z: 0.3}\r\n1:{x: 0, y: 0.5, z: 0.85}\r\n2:{x: 0, y: 1, z: 1.4}\r\n3:{x: 0.5, y: 0, z: 0.75}\r\n4:{x: 0.5, y: 0.5, z: 1.275}\r\n5:{x: 0.5, y: 1, z: 1.8}\r\n6:{x: 1, y: 0, z: 1.2}\r\n7:{x: 1, y: 0.5, z: 1.7}\r\n8:{x: 1, y: 1, z: 2.2}\r\n*/\r\n\r\n```\r\n### Example 2\r\n\r\nWorking principle of algorithm is presented by a 3D surface chart ([vis.js](http://visjs.org/)), representing some discrete function of two-variables.  \r\nData before interpolation: \r\n```javascript\r\nInterpolateArray(data, 0);    \r\n```\r\n![Raw data](http://res.cloudinary.com/jablpiotrek/image/upload/c_fit,h_200,w_300/v1514856379/2d-bicubic-interpolate/0.png)\r\n\r\nData interpolated with different interpolation factors: \r\nData interpolated with different interpolation factors: \r\n```javascript\r\nInterpolateArray(data, 1);  \r\n```\r\n\r\n![N=1](http://res.cloudinary.com/jablpiotrek/image/upload/c_fit,h_200,w_300/v1514856379/2d-bicubic-interpolate/1.png)\r\n\r\n```javascript\r\nInterpolateArray(data, 10);  \r\n```\r\n![N=10](http://res.cloudinary.com/jablpiotrek/image/upload/c_fit,h_200,w_300/v1514856384/2d-bicubic-interpolate/10.png)\r\n\r\n","maintainers":[{"name":"jablpiotrek","email":"jabl.piotrek@gmail.com"}],"time":{"modified":"2022-04-04T10:18:52.496Z","created":"2018-01-01T23:25:58.588Z","1.0.0":"2018-01-01T23:25:58.588Z","1.0.1":"2018-01-02T02:43:14.475Z","1.0.2":"2018-01-02T02:50:48.715Z","1.0.3":"2018-01-03T08:13:45.531Z","1.0.5":"2018-03-24T08:41:25.728Z","1.0.6":"2018-03-25T01:31:19.648Z","1.0.7":"2018-04-16T01:38:28.534Z"},"homepage":"https://github.com/jablpiotrek/2d-bicubic-interpolate#readme","keywords":["bicubic","interpolation","array","2d"],"repository":{"type":"git","url":"git+https://github.com/jablpiotrek/2d-bicubic-interpolate.git"},"author":{"name":"Piotr Jablonski"},"bugs":{"url":"https://github.com/jablpiotrek/2d-bicubic-interpolate/issues"},"license":"MIT","readmeFilename":"README.md"}