logix1390 Posted March 9, 2017 Share Posted March 9, 2017 Hi everyone, My goal is to bevel the corners of the voronoi fracture pieces. I pretty much achieved it already, however, there are some intersecting geometries in a few corners where the angle is very tight. Is their a way to clean these intersecting geometries , as well as having control over how round the corners are. As of now, I can only round out the corners so much before it intersects. I will attach my scene for anyone who wants to take a look. Thank you ! bevel_voronoi.hip Quote Link to comment Share on other sites More sharing options...
Blacklisted_Guy Posted June 1, 2017 Share Posted June 1, 2017 (edited) I think I might be a bit late to the party. This is how I'd solve it bevel_voronoi.hiplc Edited June 1, 2017 by Blacklisted_Guy Quote Link to comment Share on other sites More sharing options...
logix1390 Posted June 11, 2017 Author Share Posted June 11, 2017 This works , thank you I'm actually still learning vex. Can you explain briefly what exactly is happening in that code ? Really appreciate the help ! Quote Link to comment Share on other sites More sharing options...
Blacklisted_Guy Posted June 21, 2017 Share Posted June 21, 2017 On 2017-6-11 at 8:44 PM, logix1390 said: This works , thank you I'm actually still learning vex. Can you explain briefly what exactly is happening in that code ? Really appreciate the help ! //Find the neighbours of the current point and add the to an array int neighs[] = neighbours(0, @ptnum); //Initialize values to be used in the loop float lowest = 0; int lowestI = 0; //Initialize the loop to loop as often as there are items in the "neighs" array (usually two as the point has two neighbours) for(int i = 0; i < len(neighs); i++) { //Get the position of the currently looped neighoburs vector pos = point(0, "P", neighs[i]); //Figure out the distance between the current and neighbour point float len = distance(@P, pos); //If this is the first iteration of the loop, set the lowest distance to be the current distance if(i == 0) { lowest = len; } //If this isnt the first loop and the current distance is smaller than the lowest distance, make the current distance the new lowest. else { if(lowest > len) { lowest = len; lowestI = i; } } } //set the point scale to be the lowest distance f@pscale = lowest; /* The pscale attribute is used by the bevel as a multiplier to make the bevel bigger or smaller. Because this value is equal to the lowest edge length it will never be too big for the edges it is on */ Commented out every line, hopefully this helps! 1 Quote Link to comment Share on other sites More sharing options...
Pazuzu Posted June 21, 2017 Share Posted June 21, 2017 (edited) I think that you can simplify even more the code: Quote int neighs[] = neighbours(0, @ptnum); float lowest = 10000; int lowestI = 0; for(int i = 0; i < len(neighs); i++) { vector pos = point(0, "P", neighs[i]); float len = distance(@P, pos); lowest = min(lowest,len); } f@pscale = lowest; Edited June 21, 2017 by Pazuzu 1 Quote Link to comment Share on other sites More sharing options...
logix1390 Posted June 23, 2017 Author Share Posted June 23, 2017 Blacklisted_Guy, Thank you ! This helps a lot. Really appreciate it. And thank you to Pazuzu!! 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.