Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

primitive-cylinder

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

primitive-cylinder

A minimal 3D cylindrical geometry, including normals, UVs, and mesh.

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

primitive-cylinder

stable

screen

(demo)

A minimal 3D cylindrical geometry, including normals, UVs, and mesh.

Example

var cylinder = require('primitive-cylinder')
var mesh = cylinder(10, 10, 50, 10, 10)

// the simplicial complex
console.log(mesh.positions, mesh.cells)

// rendering attributes
console.log(mesh.uvs)
console.log(mesh.normals)

Usage

NPM

mesh = cylinder(radiusTop, radiusBottom, height, radialSegments, heightSegments)

Creates a new torus with options:

  • radiusTop the radius of the cylinder at the top
  • radiusBottom the radius of the cylinder at the bottom
  • height the height of the cylinder
  • radialSegments the number of segments for the radial axis
  • heightSegments the number of segments for the height axis

The returned mesh is an object with the following data:

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

Note that you can build a cone by setting one of the radii to be zero.

Contributing

See stackgl/contributing for details.

Credits

The algorithm here is from ThreeJS CylinderGeometry.

License

MIT. See LICENSE.md for details.

Keywords

ecosystem:stackgl

FAQs

Package last updated on 09 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts