Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thibauts/rescale-vertices
Rescales vertices to the dimensions of a target bounding box
https://github.com/thibauts/rescale-vertices
Last synced: 2 months ago
JSON representation
Rescales vertices to the dimensions of a target bounding box
- Host: GitHub
- URL: https://github.com/thibauts/rescale-vertices
- Owner: thibauts
- License: mit
- Created: 2015-03-01T20:37:45.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-01T20:38:08.000Z (almost 10 years ago)
- Last Synced: 2024-10-04T12:36:19.905Z (3 months ago)
- Language: JavaScript
- Size: 102 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
rescale-vertices
================
### Rescales vertices to the dimensions of a target bounding boxAccepts bounding boxes and positions of arbitrary dimensions.
Install
-------```bash
$ npm install rescale-vertices
```Usage
-----```javascript
var rescaleVertices = require('rescale-vertices');var positions = [
[-1, 0, 0],
[ 1, 0, -1],
[ 0, -1, 0],
[ 0, 1, 1]
];var targetBounds = [
[-1, -2, -3],
[ 1, 2, 3]
];// Takes the source bounding-box as an optional 3rd parameter.
// If not provided the bounding-box is computed internally.
var positions = rescaleVertices(positions, targetBounds /*, sourceBounds */);console.log(positions);
/*
[
[ -1, 0, 0 ],
[ 1, 0, -3 ],
[ 0, -2, 0 ],
[ 0, 2, 3 ]
]
*/
```