Triangulation sphere with holes

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.
The position and size of the circular holes is limited.

The triangulation according to an algorithm by E. Hartmann is much more flexible.

Chapter 7

I adapted / simplified the algorithm for the simple case of the sphere and also used an alternative angle calculation.

(Further developed February 2020 see Inner Geometry (Triangulation) )

also with a hole defined by points

How to add a circular hole:20190621-0902-39694

:white_check_mark: 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

:white_check_mark: 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


Severe maths! :+1: All that we like! :beers:

1 Like

With the sphere, it’s still elementary math.

When I have integrated the hole sphere into my addon THREEg I will try to implement the complete algorithm of Professor Hartmann. I contacted him about this.

There is a program by him, but it is written in Pascal and I can’t take it over immediately. The languages offer quite different possibilities. Besides, everyone has his own programming style. For threejs you should store the points and indices according to the requirements of BufferGeometry.

de / en see B) 2) 2’)


The procedure has been a little simplified and updated. The properties chg and check of the front are omitted.

The angle value 0 is used for this. ( .ang === 0 )


Also in the version in the addon THREEi.

see Addon for triangulation of implicit surfaces

1 Like

Can you open the model efficiently?

I don’t know what you mean exactly.

The addon does not generate a model like software like Blender.

The addon creates an indexed BufferGeometry directly. Just like three.js does with a sphere or a cylinder etc… But the algorithm and the calculation is much more complex.

Because the calculation takes time, I created the script
This exports the attribute fields: Positions and indexes.
You get a complete three.js definition. You can copy these into your project and have the BufferGeometry ( object, form, … ) without calculating.

The last paragraph in the readme describes this.

This concerns triangulation.

Triangulation of Implicit Surfaces …

Algorithm modified.

The implicit surfaces are defined in separate js files. See examples folder.

I’m still working on the export for the sphere with holes. In addition there are cylinders and torus with holes.

1 Like

See at the end of the original post. :slightly_smiling_face:

1 Like

:white_check_mark: Update: October 18th

The algorithm for the sphere with holes previously contained no check whether the current front overlaps. The overlap check has been completed.
See original post.

1 Like


The generation of the surfaces sphere, cylinder and others use the same core functions of triangulation.

If you need several different surfaces in a scene, this is repetitive code.
Therefore I summarize triangulation of sphere, cylinder and other surfaces with holes.

In the test example you can observe the birth of the :stars: with the slider.

Further surfaces will be added.

Update February 2020 see Inner Geometry (Triangulation)

Coming soon on GitHub. :christmas_tree:


this has to be the most WTF thread I saw in relation to 3js, keep it going :smiley: