Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hughsk/rectangular-prism
Quickly generate an indexed mesh for a rectangular prism, because triangles.
https://github.com/hughsk/rectangular-prism
Last synced: 8 days ago
JSON representation
Quickly generate an indexed mesh for a rectangular prism, because triangles.
- Host: GitHub
- URL: https://github.com/hughsk/rectangular-prism
- Owner: hughsk
- License: other
- Created: 2014-07-09T05:17:24.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-07-09T05:17:27.000Z (over 10 years ago)
- Last Synced: 2024-10-17T16:38:56.010Z (22 days ago)
- Language: JavaScript
- Size: 105 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# rectangular-prism [![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)
Quickly generate an [indexed mesh](http://github.com/hughsk/indexed-geometry-demo)
for a rectangular prism, because triangles.![cube](http://imgur.com/ovGeDBD.png)
## Usage
[![NPM](https://nodei.co/npm/rectangular-prism.png)](https://nodei.co/npm/rectangular-prism/)
### mesh = prism([size], [position])
Returns a [simplicial-complex](https://github.com/mikolalysenko/simplicial-complex)-style
mesh, i.e. an object with two properties:* `mesh.positions`: the prism's vertices.
* `mesh.cells`: the prism's faces.If you don't pass the function any arguments, you'll simply get a unit (1x1x1)
cube mesh in return. You can optionally pass in the following arguments for
your convenience:* `size`: the size of the prism. May either be a number (if you just want a cube),
or an array with the `[x, y, z]` dimensions of your new mesh. Defaults to `1`.
* `position`: an array containing the `[x, y, z]` position of the mesh. Defaults
to `[0, 0, 0]`.## License
MIT. See [LICENSE.md](http://github.com/hughsk/rectangular-prism/blob/master/LICENSE.md) for details.