Negatively Proportional Model

    primitive-capsule

    3.0.1 • Public • Published

    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.

    Install

    npm i primitive-capsule

    DownloadsWeekly Downloads

    16

    Version

    3.0.1

    License

    MIT

    Last publish

    Collaborators

    • vorg