For example, if I have 20 points evenly distributed on the sphere, how should I calculate

topic description

in the process of learning three.js, I saw the process of using three.js to draw a sphere, in which the key part, given a certain number of points, evenly distributed on a sphere, his code is as follows, but does not understand the details

            // sphere

            var vector = new THREE.Vector3();
            var spherical = new THREE.Spherical();

            for ( var i = 0, l = objects.length; i < l; i PP ) {

                var phi = Math.acos( -1 + ( 2 * i ) / l );
                var theta = Math.sqrt( l * Math.PI ) * phi;

                var object = new THREE.Object3D();

                spherical.set( 800, phi, theta );

                object.position.setFromSpherical( spherical );

                vector.copy( object.position ).multiplyScalar( 2 );

                object.lookAt( vector );

                targets.sphere.push( object );

            }
            
    

here we are looking for phi and theta . I don"t understand how it is calculated. How does it work out?

original address

Apr.03,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e887d2-46c97.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e887d2-46c97.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?