Jump to content

rounded cube/box


javalang
 Share

Recommended Posts

Hello forum,

hopefully finding an answer here, I'm looking for a simple algorithm for a rounded-cube with params like width/heigth/depth. edge-radius and number of segments. Ive ported the "superellipse" algo but for a seamless result the numer of verticies IMHO is mucht too high (about 8000) and scaling in one direction has negative influences for the edge radius when leaving the quad shape.

As far I've searched in the internet, this topic seems not so easy, or am I wrong?

Anyway, here is my playground : http://www.babylonjs-playground.com/#14VFYX

Thank you in advance

 

 

Link to comment
Share on other sites

You need to make a cube with how ever many sub divisions if you normalize a cubes positions they will become a 0.5 radius sphere so the. To get them back to the size of the original cube you multiply the vectors by the half the size of original cube 1 sec let me see if I can find a diagram I made up

 

***edit***

question.jpg.925c4c8b2aa0f5b3a85a30e2c79

Here you go it's asking a question unrelated but it's the same kind of concept.

Now to just do this to the edges you will have to make sure you only to it to the points so many from the edge or how many steps you would want to round it I assume, and the closer these points then the smoother the curve? I'm not sure this is kinda a shot in the dark but I think it's in the right direction

 

the other method would be to use extrudes for the curves and make some sort of equation to make the quarter circle to start withs radius match to the gap between 6 planes set up like a cube then combine the meshes but again never done it but I assume it can be done.  Also look up how they do it in 3D programs and that will be a good start, a lot of that stuff is documented.

Link to comment
Share on other sites

  • 9 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...