1.0.0 • Published 10 years ago
torus-mesh v1.0.0
torus-mesh
Generates an indexed 3D torus mesh.
var torus = require('torus-mesh')
var mesh = torus()
console.log(mesh)
=> { positions, cells, normals, uvs }It returns a simplicial complex, but also includes normals and uvs for lighting and texturing.
Usage
mesh = torus([opt])
Creates a new torus with options:
majorRadiusthe radius of the major ringR, default 1.0minorRadiusthe radius of the minor ringr, default 0.25majorSegmentsthe number of segments for the major ring, default 32minorSegmentsthe number of segments for the minor ring, defualt 64arcthe arc to draw, defaultMath.PI * 2(full circle)
Credits
The algorithm here is from ThreeJS TorusGeometry.
License
MIT. See LICENSE.md for details.
1.0.0
10 years ago
