2.1.0 • Published 4 months ago

geom-export-obj v2.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months 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/vertexColors) into an OBJ string (optionally optimized with number precision to reduce its size).

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, precision) ⇒ string

Parse a simplicial complex and return an obj string

Kind: static method of geomExportObj See

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

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.
precisionnumberDecimal digit precision for positions/normals/uvs/vertexColors.

GeomExportObjReturnValue : object

Kind: global typedef Properties

NameTypeDescription
outputstringThe obj as a string.
offsetsGeomExportObjOffsets

License

MIT. See license file.

2.1.0

4 months ago

2.0.0

4 months ago

1.1.1

1 year ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago