# 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.
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
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!

11 Likes

Severe maths! All that we like!

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

2 Likes

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 https://github.com/hofk/THREEi.js/blob/61ba83531881d9c6f7a5125dec63a27410ea3f50/examples/triangulationImplicitSurfaceExportGeo.html.
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.

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.

1 Like

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 with the slider.
https://hofk.de/main/threejs/1TEST/InnerGeometryTriangulation221219.html