Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hughsk/face-normals
Given an array of triangles' vertices, return a `Float32Array` of their normal vectors.
https://github.com/hughsk/face-normals
Last synced: 12 days ago
JSON representation
Given an array of triangles' vertices, return a `Float32Array` of their normal vectors.
- Host: GitHub
- URL: https://github.com/hughsk/face-normals
- Owner: hughsk
- Created: 2013-11-14T02:36:13.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2013-11-14T02:38:10.000Z (almost 11 years ago)
- Last Synced: 2024-10-17T16:40:30.528Z (22 days ago)
- Language: JavaScript
- Size: 184 KB
- Stars: 5
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# face-normals [![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) #
Given an array of triangles' vertices, return a `Float32Array` of their normal
vectors. Helpful for quickly calculating the the normals of a mesh (assuming
it's made up of triangles).[see the demo](http://hughsk.github.io/face-normals), and how it compares to
[`heightmap-mesher`](http://hughsk.github.io/heightmap-mesher)'s, for some
example usage.## Installation ##
[![face-normals](https://nodei.co/npm/face-normals.png?mini=true)](https://nodei.co/npm/face-normals)
## Usage ##
### `require('face-normals')(triangles, [output])` ###
Takes an array-like list of `triangles`. Each vertex should take up 3 elements,
combined into groups of 3 to make each triangle. Optionally, you can pass in
an array-like `output` object to set the values directly. If not, a
`Float32Array` will be created for you - either way, the new/updated array will
be returned.