geom-export-obj

Convert one (or more) simplicial complex geometry (positions/cells/normals/uvs/vertexColors) into an OBJ string (optionally optimized with number precision to reduce its size).


Installation
npm install geom-export-obj
Usage
import geomExportObj from "geom-export-obj";
import { cube } from "primitive-geometry";
console.log(geomExportObj(cube()).output);
API
Modules
- geomExportObj
Typedefs
- SimplicialComplex :
object
Geometry definition. All optional.
- GeomExportObjOffsets :
object
Offsets to for cells. Useful if appending to another obj string. Used internally.
- GeomExportObjOptions :
object
Options for exporter.
- GeomExportObjReturnValue :
object
geomExportObj
Parse one or more simplicial complex geometry and return an obj string and vertices offsets.
Kind: Exported function
geomExportObj.parse(geometry, [offsets], [defaultName], [precision]) ⇒ string
Parse a simplicial complex and return an obj string
Kind: static method of geomExportObj
See
geometry | SimplicialComplex | | |
[offsets] | GeomExportObjOffsets | { positions: 0, normals: 0, uvs: 0 }} | |
[defaultName] | string | | A name for the object if geometry.name is not specified. |
[precision] | number | | Decimal digit precision for positions/normals/uvs/vertexColors. |
SimplicialComplex : object
Geometry definition. All optional.
Kind: global typedef
Properties
positions | Array.<number> | |
normals | Array.<number> | |
uvs | Array.<number> | |
cells | Array.<number> | |
name | string | The object name. |
[materialName] | string | The object material name. |
GeomExportObjOffsets : object
Offsets to for cells. Useful if appending to another obj string. Used internally.
Kind: global typedef
Properties
positions | number |
normals | number |
uvs | number |
GeomExportObjOptions : object
Options for exporter.
Kind: global typedef
Properties
[header] | string | "# geom-export-obj\n" | Header to be prepended to the file. |
[prefix] | string | "Mesh_" | Prefix for object names. |
[offsets] | GeomExportObjOffsets | { positions: 0, normals: 0, uvs: 0 } | The initial offsets for cells. |
[precision] | number | | Decimal digit precision for positions/normals/uvs/vertexColors. |
GeomExportObjReturnValue : object
Kind: global typedef
Properties
License
MIT. See license file.