javalang Posted March 13, 2016 Share Posted March 13, 2016 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 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 13, 2016 Share Posted March 13, 2016 Normalize all the points you want to round on the cube and then multiply them by a height offset. Quote Link to comment Share on other sites More sharing options...
javalang Posted March 13, 2016 Author Share Posted March 13, 2016 Thank you Pryme8, but I cannot follow. Starting from a ideal (sharp) cube, offset-multiplying will not change the amount of verticies and I've got still sharp edges. Can you point me to an example? Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 13, 2016 Share Posted March 13, 2016 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*** 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. Quote Link to comment Share on other sites More sharing options...
javalang Posted March 13, 2016 Author Share Posted March 13, 2016 Your last method brings me to an idea..., thank you for your effort Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted December 14, 2016 Share Posted December 14, 2016 http://www.babylonjs-playground.com/#1ZEABJ#6 adam 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.