Hello
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?
Hello
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
A small example from the collection .
You can also make holes in the sphere and cylinder.
It is a little more complicated.
Triangulation cylinder with holes
Triangulation sphere with holes
@prisoner849 @hofk thank you very much!!
Worked like a charm
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