# Bevel corners on Voronoi Fracture

## 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

##### Share on other sites
Posted (edited)

I think I might be a bit late to the party.

This is how I'd solve it

bevel_voronoi.hiplc

Edited by Blacklisted_Guy

##### Share on other sites

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 !

##### Share on other sites
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

##### Share on other sites
Posted (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 by Pazuzu
• 1

##### Share on other sites

Blacklisted_Guy, Thank you ! This helps a lot. Really appreciate it. And thank you to Pazuzu!!

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account