MCPcopy Create free account
hub / github.com/collidingScopes/iron-interface / createTorus

Function createTorus

geometry.js:90–106  ·  view source on GitHub ↗
(i, count)

Source from the content-addressed store, hash-verified

88}
89
90function createTorus(i, count) {
91 // Torus parameters
92 const R = 30; // Major radius (distance from center of tube to center of torus)
93 const r = 10; // Minor radius (radius of the tube)
94
95 // Use a uniform distribution on the torus surface
96 // by using uniform sampling in the 2 angle parameters
97 const u = (i / count) * 2 * Math.PI; // Angle around the center of the torus
98 const v = (i * Math.sqrt(5)) * 2 * Math.PI; // Angle around the tube
99
100 // Parametric equation of a torus
101 return new THREE.Vector3(
102 (R + r * Math.cos(v)) * Math.cos(u),
103 (R + r * Math.cos(v)) * Math.sin(u),
104 r * Math.sin(v)
105 );
106}
107
108function createVortex(i, count) {
109 // Vortex parameters

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected