Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thibauts/serialize-stl-binary

STL binary serialization
https://github.com/thibauts/serialize-stl-binary

Last synced: 21 days ago
JSON representation

STL binary serialization

Awesome Lists containing this project

README

        

serialize-stl-binary
====================
### STL binary serialization

Produces a [STL](http://en.wikipedia.org/wiki/STL_%28file_format%29) (STereoLithography) binary buffer from a mesh. Face normals are computed internally if not provided.

Install
-------

```bash
$ npm install serialize-stl-binary
```

Usage
-----

```javascript
var serializeSTL = require('serialize-stl-binary');
var fs = require('fs');

var mesh = {
positions: [
[-1.0, 0.0, 0.0],
[ 0.0, 1.0, 0.0],
[ 1.0, 0.0, 0.0]
],
cells: [
[0, 1, 2]
]
};

var buf = serializeSTL(mesh.cells, mesh.positions/*, faceNormals*/);
fs.writeFileSync('mesh.stl', buf);
```