primitive-octasphere
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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

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

createOctasphere([options])SimplicialComplex

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

Typedefs

vec2 : Array.<number>
vec3 : Array.<number>
OctasphereOptions : Object
SimplicialComplex : Object

Geometry definition.

createOctasphere([options]) ⇒ SimplicialComplex

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

Kind: global function

Param Type Default
[options] OctasphereOptions {}

vec2 : Array.<number>

Kind: global typedef

vec3 : Array.<number>

Kind: global typedef

OctasphereOptions : Object

Kind: global typedef
Properties

Name Type Default
[radius] number 0.5
[subdivisions] number 2

SimplicialComplex : Object

Geometry definition.

Kind: global typedef
Properties

Name Type
positions Array.<vec3>
normals Array.<vec3>
uvs Array.<vec2>
cells Array.<vec3>

License

MIT. See license file.

Versions

Current Tags

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

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    2
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i primitive-octasphere

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

12.8 kB

Total Files

6

Last publish

Collaborators

  • dmnsgn