Convert one (or more) simplicial complex geometry (positions/cells/normals/uvs) into an OBJ string.

npm install geom-export-obj
import geomExportObj from "geom-export-obj";
import { cube } from "primitive-geometry";
console.log(geomExportObj(cube()).output);
ObjectGeometry definition. All optional.
ObjectOffsets to for cells. Useful if appending to another obj string. Used internally.
ObjectOptions for exporter.
ObjectGeomExportObjReturnValue ⏏Parse one or more simplicial complex geometry and return an obj string and vertices offsets.
Kind: Exported function
| Param | Type | Default |
|---|---|---|
| geometries | SimplicialComplex | Array.<SimplicialComplex> |
|
| [options] | GeomExportObjOptions |
{} |
stringParse a simplicial complex and return an obj string
Kind: inner method of geomExportObj
See: http://paulbourke.net/dataformats/obj/
| Param | Type | Default | Description |
|---|---|---|---|
| geometry | SimplicialComplex |
||
| [offsets] | GeomExportObjOffsets |
{ positions: 0, normals: 0, uvs: 0 }} |
|
| [defaultName] | string |
A name for the object if geometry.name is not specified. |
ObjectGeometry definition. All optional.
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| positions | Array.<number> |
|
| normals | Array.<number> |
|
| uvs | Array.<number> |
|
| cells | Array.<number> |
|
| name | string |
The object name. |
| [materialName] | string |
The object material name. |
ObjectOffsets to for cells. Useful if appending to another obj string. Used internally.
Kind: global typedef
Properties
| Name | Type |
|---|---|
| positions | number |
| normals | number |
| uvs | number |
ObjectOptions for exporter.
Kind: global typedef
Properties
| Name | Type | Default | Description |
|---|---|---|---|
| [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. |
ObjectKind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| output | string |
The obj as a string. |
| offsets | GeomExportObjOffsets |
MIT. See license file.