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

Function createMobius

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

Source from the content-addressed store, hash-verified

199}
200
201function createMobius(i, count) {
202 // Möbius strip parameters
203 const radius = 25; // Major radius of the strip
204 const width = 10; // Width of the strip
205
206 // Distribute points evenly along the length of the Möbius strip
207 // and across its width
208 const lengthSteps = Math.sqrt(count);
209 const widthSteps = count / lengthSteps;
210
211 // Calculate position along length and width of strip
212 const lengthIndex = i % lengthSteps;
213 const widthIndex = Math.floor(i / lengthSteps) % widthSteps;
214
215 // Normalize to 0-1 range
216 const u = lengthIndex / lengthSteps; // Position around the strip (0 to 1)
217 const v = (widthIndex / widthSteps) - 0.5; // Position across width (-0.5 to 0.5)
218
219 // Parametric equations for Möbius strip
220 const theta = u * Math.PI * 2; // Full loop around
221
222 // Calculate the Möbius strip coordinates
223 // This creates a half-twist in the strip
224 const x = (radius + width * v * Math.cos(theta / 2)) * Math.cos(theta);
225 const y = (radius + width * v * Math.cos(theta / 2)) * Math.sin(theta);
226 const z = width * v * Math.sin(theta / 2);
227
228 return new THREE.Vector3(x, y, z);
229}
230
231function createSupernova(i, count) {
232 // Supernova parameters

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected