Comparing version 1.0.1 to 1.1.0
# v1.1.0 2022-09-28 | ||
- Added setter/getter for the `epsilon` | ||
# v1.0.1 2021-03-09 | ||
* Include a copy of tinyqueue in the npm distrib. | ||
- Include a copy of tinyqueue in the npm distrib. | ||
# v1.0.0 2021-03-09 | ||
* Initial release | ||
* API shape is considered stable - implementation of flat arrays as per bug #1 would mean a major version change (to 2.0.0) | ||
- Initial release | ||
- API shape is considered stable - implementation of flat arrays as per bug #1 would mean a major version change (to 2.0.0) |
{ | ||
"type": "module", | ||
"devDependencies": { | ||
"proj4": "^2.7.0" | ||
}, | ||
"dependencies": { | ||
"tinyqueue": "^2.0.3" | ||
}, | ||
"name": "arrugator", | ||
"version": "1.0.1", | ||
"description": "Utility for warping GIS-like triangular meshes to fit a projection; meant for helping WebGL raster reprojection.", | ||
"main": "arrugator.mjs", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://git@gitlab.com/IvanSanchez/arrugator.git" | ||
}, | ||
"keywords": [ | ||
"webgl", | ||
"mesh", | ||
"projection", | ||
"warp" | ||
], | ||
"author": "Iván Sánchez Ortega <ivan@sanchezortega.es>", | ||
"license": "GPL-3.0", | ||
"bugs": { | ||
"url": "https://gitlab.com/IvanSanchez/arrugator/issues" | ||
}, | ||
"homepage": "https://gitlab.com/IvanSanchez/arrugator#readme" | ||
"type": "module", | ||
"devDependencies": { | ||
"proj4": "^2.7.0" | ||
}, | ||
"dependencies": { | ||
"tinyqueue": "^2.0.3" | ||
}, | ||
"name": "arrugator", | ||
"version": "1.1.0", | ||
"description": "Utility for warping GIS-like triangular meshes to fit a projection; meant for helping WebGL raster reprojection.", | ||
"main": "arrugator.mjs", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://git@gitlab.com/IvanSanchez/arrugator.git" | ||
}, | ||
"keywords": [ | ||
"webgl", | ||
"mesh", | ||
"projection", | ||
"warp" | ||
], | ||
"author": "Iván Sánchez Ortega <ivan@sanchezortega.es>", | ||
"license": "GPL-3.0", | ||
"bugs": { | ||
"url": "https://gitlab.com/IvanSanchez/arrugator/issues" | ||
}, | ||
"homepage": "https://gitlab.com/IvanSanchez/arrugator#readme" | ||
} |
@@ -11,17 +11,16 @@ # Arrugator | ||
* A `projector` function (which takes an `Array` of 2 `Number`s, and returns an `Array` of 2 `Number`s). Typically this is meant to be a [`proj4js`](proj4js.org) forward projection function, like `proj4(srcCRS, destCRS).forward`; however, arrugator has no hard dependency on proj4js, so other projection methods could be used. | ||
* The unprojected coordinates (an `Array` of `Array`s of 2 `Number`s, typically NW-SW-NE-SE) | ||
* The [UV-mapping](https://en.wikipedia.org/wiki/UV_mapping) coordinates (an `Array` of `Array`s of 2 `Number`s, typically `[[0,0],[0,1],[1,0],[1,1]]`) | ||
* The vertex indices of the triangles composing the initial mesh (an `Array` of `Array`s of 3 `Number`s, typically `[[0,1,3],[0,3,2]]`). | ||
- A `projector` function (which takes an `Array` of 2 `Number`s, and returns an `Array` of 2 `Number`s). Typically this is meant to be a [`proj4js`](proj4js.org) forward projection function, like `proj4(srcCRS, destCRS).forward`; however, arrugator has no hard dependency on proj4js, so other projection methods could be used. | ||
- The unprojected coordinates (an `Array` of `Array`s of 2 `Number`s, typically NW-SW-NE-SE) | ||
- The [UV-mapping](https://en.wikipedia.org/wiki/UV_mapping) coordinates (an `Array` of `Array`s of 2 `Number`s, typically `[[0,0],[0,1],[1,0],[1,1]]`) | ||
- The vertex indices of the triangles composing the initial mesh (an `Array` of `Array`s of 3 `Number`s, typically `[[0,1,3],[0,3,2]]`). | ||
Note that the *typical* input is four vertices, but there's no hard requirement on that. Any triangular mesh should do (and *maybe* there are edge cases I haven't think of where it's required so things work for *weird* projections like polyhedral ones). | ||
Note that the _typical_ input is four vertices, but there's no hard requirement on that. Any triangular mesh should do (and _maybe_ there are edge cases I haven't think of where it's required so things work for _weird_ projections like polyhedral ones). | ||
And the ouputs are: | ||
* The unprojected vertex coordinates (an `Array` of `Array`s of 2 `Number`s) | ||
* The projected vertex coordinates (an `Array` of `Array`s of 2 `Number`s) | ||
* The [UV-mapping](https://en.wikipedia.org/wiki/UV_mapping) coordinates (an `Array` of `Array`s of 2 `Number`s) | ||
* The vertex indices of the triangles composing the mesh (an `Array` of `Array`s of 3 `Number`s). | ||
- The unprojected vertex coordinates (an `Array` of `Array`s of 2 `Number`s) | ||
- The projected vertex coordinates (an `Array` of `Array`s of 2 `Number`s) | ||
- The [UV-mapping](https://en.wikipedia.org/wiki/UV_mapping) coordinates (an `Array` of `Array`s of 2 `Number`s) | ||
- The vertex indices of the triangles composing the mesh (an `Array` of `Array`s of 3 `Number`s). | ||
### Usage example | ||
@@ -34,20 +33,23 @@ | ||
let epsg25830coords = [ | ||
[-368027.127, 4880336.821], // top-left | ||
[-368027.127, 3859764.821], // bottom-left | ||
[1152416.873, 4880336.821], // top-right | ||
[1152416.873, 3859764.821], // bottom-right | ||
[-368027.127, 4880336.821], // top-left | ||
[-368027.127, 3859764.821], // bottom-left | ||
[1152416.873, 4880336.821], // top-right | ||
[1152416.873, 3859764.821], // bottom-right | ||
]; | ||
let sourceUV = [ | ||
[0, 0], // top-left | ||
[0, 1], // bottom-left | ||
[1, 0], // top-right | ||
[1, 1], // bottom-right | ||
[0, 0], // top-left | ||
[0, 1], // bottom-left | ||
[1, 0], // top-right | ||
[1, 1], // bottom-right | ||
]; | ||
let arruga = new Arrugator( | ||
proj4('EPSG:25830','EPSG:3034').forward, | ||
proj4("EPSG:25830", "EPSG:3034").forward, | ||
epsg25830coords, | ||
sourceUV, | ||
[[0,1,3],[0,3,2]] // topleft-bottomleft-bottomright ; topleft-bottomright-topright | ||
[ | ||
[0, 1, 3], | ||
[0, 3, 2], | ||
] // topleft-bottomleft-bottomright ; topleft-bottomright-topright | ||
); | ||
@@ -65,3 +67,3 @@ ``` | ||
```js | ||
for (let i=0; i<10; i++) { | ||
for (let i = 0; i < 10; i++) { | ||
arruga.step(); | ||
@@ -74,3 +76,3 @@ } | ||
```js | ||
arruga.lowerEpsilon(1000000); // 1000 "meter"s, squared | ||
arruga.lowerEpsilon(1000000); // 1000 "meter"s, squared | ||
``` | ||
@@ -84,5 +86,5 @@ | ||
let unprojectedCoords = arrugado.unprojected; | ||
let projectedCoords = arrugado.projected; | ||
let uvCoords = arrugado.uv; | ||
let trigs = arrugado.trigs; | ||
let projectedCoords = arrugado.projected; | ||
let uvCoords = arrugado.uv; | ||
let trigs = arrugado.trigs; | ||
``` | ||
@@ -107,4 +109,2 @@ | ||
### Demos | ||
@@ -114,6 +114,4 @@ | ||
### Legalese | ||
Released under the General Public License, v3. See the LICENSE file for details. | ||
Sorry, the diff of this file is not supported yet
50888
310
111