I am trying to create a simulation of 3D distribution of galaxies.
The galaxies are points.
rawFile.open("GET", "galaxydata1.txt", false); var parts = data[i].split("\t"); var D = parts; var glon = parts*3.1416/180; var glat = parts*3.1416/180; var z = D*Math.sin(glat); var xy = D*Math.cos(glat); var x = xy*Math.cos(glon); var y = xy*Math.sin(glon); dotGeometry.vertices.push(new THREE.Vector3( x, y, z ));
I want the simulation to work in resource-limited devices. So, I figured that I can calculate the positions beforehand and save them in a file.
var parts = data[i].split(" "); rawFile.open("GET", "galaxydata2.txt", false); dotGeometry.vertices.push(new THREE.Vector3( parts, parts, parts ));
Now, I have implemented a galaxy search function, which searches a galaxy by name and centers it using:
controls.target = dots.geometry.vertices[i];
You may try it by searching for m31 (one of the names for the Andromeda galaxy).
I have spent tens of hours since the last 2 days trying to find the cause, but cannot get head or tail of it.
Note that I have used exactly the same code to calculate the positions in both the cases.
Most probably, I am missing something which would be immediately clear to the experts here.
If / when possible, please guide me.