1.1.1 • Published 1 year ago

primitive-octasphere v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

primitive-octasphere

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

An octasphere geometry for 3D rendering, including normals, UVs and cell indices (faces). Based on Philip Rideout's article here.

paypal coinbase twitter

npm.io

Installation

npm install primitive-octasphere

Usage

import createOctasphere from "primitive-octasphere";

const geometry = createOctasphere();

console.log(geometry);
// {
//   positions: [ [x, y, z], [x, y, z], ... ],
//   cells: [ [a, b, c], [a, b, c], ... ],
//   uvs: [ [u, v], [u, v], ... ],
//   normals: [ [x, y, z], [x, y, z], ... ]
// }

API

Functions

Typedefs

createOctasphere(options) ⇒ SimplicialComplex

An octasphere geometry for 3D rendering, including normals, UVs and cell indices (faces).

Kind: global function

ParamTypeDefault
optionsOctasphereOptions{}

vec2 : Array.<number>

Kind: global typedef

vec3 : Array.<number>

Kind: global typedef

OctasphereOptions : object

Kind: global typedef Properties

NameTypeDefault
radiusnumber0.5
subdivisionsnumber2

SimplicialComplex : object

Geometry definition.

Kind: global typedef Properties

NameType
positionsArray.<vec3>
normalsArray.<vec3>
uvsArray.<vec2>
cellsArray.<vec3>

License

MIT. See license file.