The triangulation of the different shapes (sphere, cylinder, torus … plane surfaces) uses the same algorithm with only small differences due to the mathematical dependencies.

See

Triangulation sphere with holes

Triangulation cylinder with holes

If you want to combine different shapes into an inner geometry, it is better to have only one function. This function then uses the appropriate mathematics for the geometry (normal, surface point …).

In addition to the triangulation functions, the construction of the matching fronts (boundaries, holes) causes a not inconsiderable effort. Currently approximately 1 to 1. If other forms are added (torus), the ratio shifts further.

Cylinders can be connected excentrically with tilt and have tilted caps.

A first example https://hofk.de/main/threejs/Triangulation/01_InnerGeometry.html

Use the slider.

another example https://hofk.de/main/threejs/Triangulation/02_InnerGeometry.html

**GitHub** https://github.com/hofk/THREEi.js

examples

https://github.com/hofk/THREEi.js/blob/master/examples/InnerGeometryTHREEi_01.html

https://github.com/hofk/THREEi.js/blob/master/examples/InnerGeometryTHREEi_02.html