JSPM

primitive-capsule

3.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q40870F
  • License MIT

A minimal capsule geometry for 3D rendering, including normals, UVs and cell indices (faces).

Package Exports

  • primitive-capsule

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (primitive-capsule) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

primitive-capsule

stable

A minimal capsule geometry for 3D rendering, including normals, UVs and cell indices (faces).

Usage

NPM

mesh = createCapsule([r, h, numSubdivisionsHeight, numSegments])

Parameters:
r - radius, defaults to 0.5 h - height, defaults to r*2
numSubdivisionsHeight - num height segments, defaults to 12 numSegments - num side segments, defaults to 12

Example

var createCapsule = require('primtivie-capsule');
var capsule = createCapsule();

capsule will have the following structure:

{
  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], ... ]
}

Demo

Download or clone this repo and run:

cd demo
npm install
npm start

Credits

Ported from C++ code from Cinder https://github.com/cinder/Cinder

License

MIT, see LICENSE.md for details.