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

Function createGalaxy

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

Source from the content-addressed store, hash-verified

136}
137
138function createGalaxy(i, count) {
139 // Galaxy parameters
140 const numArms = 4; // Number of spiral arms
141 const armWidth = 0.15; // Width of each arm (0-1)
142 const maxRadius = 40; // Maximum radius of the galaxy
143 const thickness = 5; // Vertical thickness
144 const twistFactor = 2.5; // How much the arms twist
145
146 // Determine which arm this particle belongs to
147 const armIndex = i % numArms;
148 const indexInArm = Math.floor(i / numArms) / Math.floor(count / numArms);
149
150 // Calculate radial distance from center
151 const radialDistance = indexInArm * maxRadius;
152
153 // Add some randomness for arm width
154 const randomOffset = (Math.random() * 2 - 1) * armWidth;
155
156 // Calculate angle with twist that increases with distance
157 const armOffset = (2 * Math.PI / numArms) * armIndex;
158 const twistAmount = twistFactor * indexInArm;
159 const angle = armOffset + twistAmount + randomOffset;
160
161 // Add height variation that decreases with distance from center
162 const verticalPosition = (Math.random() * 2 - 1) * thickness * (1 - indexInArm * 0.8);
163
164 return new THREE.Vector3(
165 Math.cos(angle) * radialDistance,
166 verticalPosition,
167 Math.sin(angle) * radialDistance
168 );
169}
170
171function createWave(i, count) {
172 // Wave/ocean parameters

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected