Combine cube and Lathe

Hi,
Is it possible to combine or merge a lathe with 2 boxes similar to the attached image?

Any pointers, help or info greatly appreciated.

Thanks

With CSG or without CSG?

You can use BufferGeometryUtils.mergeBufferGeometries() for merging multiple geometries in a single instance. Normally, you want to transform the geometries before doing that so for example your cubes end up at the top and bottom. This can be achieved by directly transforming the geometries you want to merge via methods like translate() or rotateY(). The minecraft demo is a good code template for this.

1 Like

Hi, without CSG.

1 Like

HI, thanks for the information and will read up on this!

I have not used BufferGeometryUtils.mergeBufferGeometries yet, would you know what the expected outcome would be where the lathe intersects the cube?

Would the two merge as the image producing the slightly domed effect on the cube?

Thanks again!

Nope, but you can shape it :slight_smile:

There are one lathe geometry and two box geometries, merged into a single one.
Example: https://codepen.io/prisoner849/pen/rNrqxBG

PS It’s not the ultimate solution, it’s just an example. I would go with a custom geometry for end elements.

5 Likes

The curved lower or upper side of the cuboid certainly corresponds to a piece of a spherical surface. If you then want to fit a cylinder or lathe exactly, you need the section curve.

Something like that I did there:

Triangulation sphere with holes
Inner Geometry (Triangulation)

However, this is a bit more complex. :nerd_face:

Thank you, that example was a great help!

Thank you, that’s great!
Looks like a combination of both examples will give the required result need!

I’m helping out a friend who requires the ability to design staircases online in 3d and the lathed posts are one of the final pieces that need coding.

Thanks to everyone for the help!!

1 Like

In this case I recommend a custom geometry, as already suggested by @prisoner849.

This is also not so difficult if you are not exactly a beginner.

See Multi Form Geometry

or see e.g. function buildArchaway( i ) {

Line 502 in SHOWROOM/showroomBuildt.js at 3b3e76f9c059dbf328dfe901a92454d06bedf166 · hofk/SHOWROOM · GitHub
from
Showrooms easy to generate from data of a construction drawing or dimensional sketch - now on Github

Good success! :slightly_smiling_face:

Thank you again!

Only 3 months working with three.js and still learning, so fingers crossed :slightly_smiling_face: :+1:

Progress picture of things so far and many thanks again to everyone for the help on this.

Ended up using custom geometries for the upper and lower sections and just working on the dome areas for these.