MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / _torus

Function _torus

libraries/p5.js:34863–34879  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34861
34862 if(!this._renderer.geometryInHash(gId)){
34863 var _torus = function(){
34864 var u,v,p;
34865 for (var i = 0; i <= this.detailY; i++){
34866 v = i / this.detailY;
34867 for (var j = 0; j <= this.detailX; j++){
34868 u = j / this.detailX;
34869 var theta = 2 * Math.PI * u;
34870 var phi = 2 * Math.PI * v;
34871 p = new p5.Vector(
34872 (radius + tubeRadius * Math.cos(phi)) * Math.cos(theta),
34873 (radius + tubeRadius * Math.cos(phi)) * Math.sin(theta),
34874 tubeRadius * Math.sin(phi));
34875 this.vertices.push(p);
34876 this.uvs.push([u,v]);
34877 }
34878 }
34879 };
34880 var torusGeom = new p5.Geometry(detailX, detailY, _torus);
34881 torusGeom
34882 .computeFaces()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected