There are two different simple versions of spheres with holes.
Sphere with up to 6 coordinate planes parallel holes
In order to arrange the holes freely, a different procedure is required.
A version uses a division of the hemispheres.
http://threejs.hofk.de/sphere/SphereCutAsWanted.html
The position and size of the circular holes is limited.
The triangulation according to an algorithm by E. Hartmann is much more flexible.
See
https://www2.mathematik.tu-darmstadt.de/~ehartmann/cdgen0104.pdf
Chapter 7
TRIANGULATION OF IMPLICIT SURFACES
I adapted / simplified the algorithm for the simple case of the sphere and also used an alternative angle calculation.
http://threejs.hofk.de/Triangulation/TriangulationSphereWithHoles.html
(Further developed February 2020 see Inner Geometry (Triangulation) )
also with a hole defined by points
How to add a circular hole:
Update: October 7th
Another variant of the sphere with holes was created. A parameter object is used .The rough side length of the triangles is to be indicated. Thus the forms sphere and cylinder (later torus) can be connected exactly with each other.
const g = new THREE.BufferGeometry( );
const parameters = {
d: 0.08, // rough side length of the triangles
div4: 30, // division of the quarter of the great circle (orthodrome)
holes: [
// circular hole, 3 elements: [ theta, phi, div4Hole ], div4Hole <= div4
[ 1.82, 0.41, 12 ],
[ 0.72, 2.55, 13 ],
// points hole,: array of points theta, phi, ... (last point is connected to first)
[ 0,0, 0.5,-0.8, 0.25,-0.27, 0.4,0.3, 0.3,0.72 ]
]
}
sphereWithHoles( g, parameters );
Try it out: TriangulationSphereWithHolesP
Update: October 18th
The algorithm for the sphere with holes previously contained no check whether the current front overlaps.
In very many cases with few holes this is not a problem.
But it can lead to errors in more complicated cases!
The overlap check has been completed.
By the way: It is always necessary for the cylinder!
See also Addon for triangulation of implicit surfaces/ forms with holes