Surface/Mesh/Loft from closed lines

Hello :slight_smile:

Is there something in Three.js to get a surface, mesh, … from two closed lines (like a loft)?
And if not, maybe there might be a good workaround?

Hi!
THREE.Shape() with a hole, passed in THREE.ShapeGeometry(). three.js examples

1 Like

A small example from the collection .

Shapes

You can also make holes in the sphere and cylinder.
It is a little more complicated.

Triangulation cylinder with holes
Triangulation sphere with holes

3 Likes

@prisoner849 @hofk thank you very much!!
Worked like a charm :slight_smile:

Sorry for coming back to it again, but maybe you’d know also a solution to copy and move the desired shape vertically like this.

I don’t want only the final mesh to be copied but also the Geometry object.

The following did not work for me

		//Slab Shape
		const floorSlabShape = new THREE.Shape(buildingPts)
		const meshSlabMaterial = new THREE.MeshBasicMaterial( { color: 0x919191 } );
		meshSlabMaterial.opacity = 0.3
		meshSlabMaterial.transparent = true

		var floorSlabShapeGeometry = new THREE.ShapeBufferGeometry(floorSlabShape);
		floorSlabMesh = new THREE.Mesh(floorSlabShapeGeometry, meshSlabMaterial);
		scene.add(floorSlabMesh);

		for (let i = 0; i < storyCount; i++) {
			var floorSlab = floorSlabShapeGeometry.clone()
			floorSlab.translate(0, 0, actualFloorHeight)
			var floorSlabMesh = new THREE.Mesh(floorSlab, meshSlabMaterial);
			scene.add(floorSlabMesh);
		}

You can clone and merge your shape geometry with BufferGeometryUtils: Edit fiddle - JSFiddle - Code Playground

1 Like