1.1.0 • Published 3 years ago

geom-export-obj v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

geom-export-obj

npm version stability-stable npm minzipped size dependencies types Conventional Commits styled with prettier linted with eslint license

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

paypal coinbase twitter

npm.io

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

Typedefs

geomExportObj

geomExportObj(geometries, options) ⇒ GeomExportObjReturnValue

Parse one or more simplicial complex geometry and return an obj string and vertices offsets.

Kind: Exported function

ParamTypeDefault
geometriesSimplicialComplex | Array.<SimplicialComplex>
optionsGeomExportObjOptions{}

geomExportObj~parse(geometry, offsets, defaultName) ⇒ string

Parse a simplicial complex and return an obj string

Kind: inner method of geomExportObj
See: http://paulbourke.net/dataformats/obj/

ParamTypeDefaultDescription
geometrySimplicialComplex
offsetsGeomExportObjOffsets{ positions: 0, normals: 0, uvs: 0 }}
defaultNamestringA name for the object if geometry.name is not specified.

SimplicialComplex : Object

Geometry definition. All optional.

Kind: global typedef
Properties

NameTypeDescription
positionsArray.<number>
normalsArray.<number>
uvsArray.<number>
cellsArray.<number>
namestringThe object name.
materialNamestringThe object material name.

GeomExportObjOffsets : Object

Offsets to for cells. Useful if appending to another obj string. Used internally.

Kind: global typedef
Properties

NameType
positionsnumber
normalsnumber
uvsnumber

GeomExportObjOptions : Object

Options for exporter.

Kind: global typedef
Properties

NameTypeDefaultDescription
headerstring"# geom-export-obj\n"Header to be prepended to the file.
prefixstring"Mesh_"Prefix for object names.
offsetsGeomExportObjOffsets{ positions: 0, normals: 0, uvs: 0 }The initial offsets for cells.

GeomExportObjReturnValue : Object

Kind: global typedef
Properties

NameTypeDescription
outputstringThe obj as a string.
offsetsGeomExportObjOffsets

License

MIT. See license file.