MCPcopy Create free account
hub / github.com/MankaiHuang/screen-visualization / fixPosition

Function fixPosition

public/iframe/lib/js/mixinsThree.js:175–204  ·  view source on GitHub ↗
(type, i)

Source from the content-addressed store, hash-verified

173 createHelixVertices();
174 createSphereVertices();
175 function fixPosition (type, i) {
176 switch (type) {
177 case 'helix': {
178 const phi = i * 0.213 + Math.PI;
179 const object = new THREE.Object3D();
180 object.position.x = 800 * Math.sin(phi);
181 object.position.y = -(i * 8) + 450;
182 object.position.z = 800 * Math.cos(phi + Math.PI);
183 return object
184 }; break;
185 case 'sphere': {
186 const phi = Math.acos(-1 + (2 * i) / objLength);
187 const theta = Math.sqrt(objLength * Math.PI) * phi;
188 const object = new THREE.Object3D();
189
190 object.position.x = 800 * Math.cos(theta) * Math.sin(phi);
191 object.position.y = 800 * Math.sin(theta) * Math.sin(phi);
192 object.position.z = -800 * Math.cos(phi);
193 return object
194 }; break;
195 case 'grid': {
196 const object = new THREE.Object3D();
197
198 object.position.x = 360 * (i % 5) - 800;
199 object.position.y = -360 * ((i / 5 >> 0) % 5) + 700;
200 object.position.z = -700 * (i / 25 >> 0);
201 return object
202 }; break;
203 }
204 }
205 function createSphereVertices () {
206
207 let i = 0;

Callers 3

createSphereVerticesFunction · 0.85
createHelixVerticesFunction · 0.85
createGridVerticesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected