michaelhoehn / fxHash-collabs

A repo for shared fxHash collabs with frens!
1 stars 1 forks source link

Introduce algorigthm for formation of rooms #1

Closed michaelhoehn closed 2 years ago

michaelhoehn commented 2 years ago

The original algorithm constructed rooms using the following steps:

The original algorithm was written in Grasshopper for Rhino and should be adapted to threejs methods accordingly.

1 2 3 4 5 6 7

michaelhoehn commented 2 years ago

Here's a helpful reference for implentation of constructive solid geometries:

https://sbcode.net/threejs/csg/

michaelhoehn commented 2 years ago

Code snippet:


                const cylinderCSG2 = CSG.fromMesh(cylinderMesh2)
                const cylinderCSG3 = CSG.fromMesh(cylinderMesh3)
                const cylindersUnionCSG = cylinderCSG1.union(cylinderCSG2.union(cylinderCSG3))
                const cylindersUnionMesh = CSG.toMesh(cylindersUnionCSG, new THREE.Matrix4())
                cylindersUnionMesh.material = new THREE.MeshPhongMaterial({ color: 0xffa500 })
                cylindersUnionMesh.position.set(2.5, 0, -3)
                scene.add(cylindersUnionMesh)
michaelhoehn commented 2 years ago

Closing as was accomplished with Room Generator #3