I am attempting to create a sphere without utilizing SphereGeometry. My approach involves drawing the sphere using latitudes and longitudes. Below is the code snippet I am working with:
for (var phi = -Math.PI / 2; phi < Math.PI / 2; phi += Math.PI / 15) {
var longVertices = new THREE.Geometry()
for (var theta = 0; theta <= 2 * Math.PI; theta += Math.PI/2 ) {
longitudes = this.point[this.numberOfVertices] = new THREE.Vector3();
longitudes.x = origin.x + this.radius * Math.cos(theta) * Math.cos(phi);
longitudes.y = origin.z + Math.sin(theta) * this.radius;
longitudes.z = origin.y + this.radius * Math.cos(theta) * Math.sin(phi);
this.numberOfVertices++;
longVertices.vertices.push(longitudes);
}
longVertices.vertices.push(longVertices.vertices[0]);
longVerticesArr.push(longVertices);
}
This piece of code enables me to draw the longitudes. https://i.sstatic.net/6k4aC.gif
And:
for (var phi = -Math.PI / 2; phi < Math.PI / 2; phi += Math.PI / 15) {
var delta = Math.cos(phi) * this.radius;
var fixedY = Math.sin(phi) * this.radius * direction;
var latVertices = new THREE.Geometry();
for (var theta = 0; theta < 2 * Math.PI; theta += Math.PI / 10) {
latitudes =/* this.point[this.numberOfVertices] =*/ new THREE.Vector3();
latitudes.z = origin.z + delta * Math.sin(theta);
latitudes.y = fixedY;
latitudes.x = origin.x + delta * Math.cos(theta);
this.numberOfVertices++;
latVertices.vertices.push(latitudes);
}
latVertices.vertices.push(latVertices.vertices[0]);
latVerticesArr.push(latVertices);
}
This code snippet assists me in drawing latitudes.
https://i.sstatic.net/ERILj.gif
Currently, I am encountering an issue where I am unable to obtain the points where both latitudes and longitudes intersect. How can I accurately determine these intersection points?