(i, count)
| 229 | } |
| 230 | |
| 231 | function createSupernova(i, count) { |
| 232 | // Supernova parameters |
| 233 | const maxRadius = 40; // Maximum explosion radius |
| 234 | const coreSize = 0.2; // Size of the dense core (0-1) |
| 235 | const outerDensity = 0.7; // Density of particles in outer shell |
| 236 | |
| 237 | // Use golden ratio distribution for even spherical coverage |
| 238 | const phi = Math.acos(1 - 2 * (i / count)); |
| 239 | const theta = Math.PI * 2 * i * (1 + Math.sqrt(5)); |
| 240 | |
| 241 | // Calculate radial distance with more particles near center and at outer shell |
| 242 | let normalizedRadius; |
| 243 | const random = Math.random(); |
| 244 | |
| 245 | if (i < count * coreSize) { |
| 246 | // Dense core - distribute within inner radius |
| 247 | normalizedRadius = Math.pow(random, 0.5) * 0.3; |
| 248 | } else { |
| 249 | // Explosion wave - distribute with more particles at the outer shell |
| 250 | normalizedRadius = 0.3 + Math.pow(random, outerDensity) * 0.7; |
| 251 | } |
| 252 | |
| 253 | // Scale to max radius |
| 254 | const radius = normalizedRadius * maxRadius; |
| 255 | |
| 256 | // Convert spherical to Cartesian coordinates |
| 257 | return new THREE.Vector3( |
| 258 | Math.sin(phi) * Math.cos(theta) * radius, |
| 259 | Math.sin(phi) * Math.sin(theta) * radius, |
| 260 | Math.cos(phi) * radius |
| 261 | ); |
| 262 | } |
| 263 | |
| 264 | function createKleinBottle(i, count) { |
| 265 | // Klein Bottle parameters |
nothing calls this directly
no outgoing calls
no test coverage detected