geom-export-obj
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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

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

geomExportObj(geometries, [options]) ⇒ GeomExportObjReturnValue

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 {}

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/

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.

SimplicialComplex : Object

Geometry 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.

GeomExportObjOffsets : Object

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

Kind: global typedef
Properties

Name Type
positions number
normals number
uvs number

GeomExportObjOptions : Object

Options 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.

GeomExportObjReturnValue : Object

Kind: global typedef
Properties

Name Type Description
output string The obj as a string.
offsets GeomExportObjOffsets

License

MIT. See license file.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    0
    • latest

Version History

Package Sidebar

Install

npm i geom-export-obj

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

17.5 kB

Total Files

8

Last publish

Collaborators

  • dmnsgn