Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

logix1390

Bevel corners on Voronoi Fracture

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 this post


Link to post
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 this post


Link to post
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!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Sign in

Already have an account? Sign in here.


Sign In Now