Jump to content

Bevel corners on Voronoi Fracture


logix1390

Recommended Posts

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

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...
  • 2 weeks later...
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!

  • Like 1
Link to comment
Share on other sites

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 by Pazuzu
  • Like 1
Link to comment
Share on other sites

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.

×
×
  • Create New...