Package Exports
- torus-mesh
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 (torus-mesh) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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:
majorRadius
the radius of the major ringR
, default 1.0minorRadius
the radius of the minor ringr
, default 0.25majorSegments
the number of segments for the major ring, default 32minorSegments
the number of segments for the minor ring, defualt 64arc
the arc to draw, defaultMath.PI * 2
(full circle)
Credits
The algorithm here is from ThreeJS TorusGeometry.
License
MIT. See LICENSE.md for details.