Jump to content
Ryuji

PolyExtrude in VEX

Recommended Posts

Hi, 

 

I've been wondering if anyone tried to recreate the polyextrude sop in vex? I'm particularly interested in the inset function of the sop, and how one would go about recreating this in vex.

 

Any ideas?

 

Thanks in advance.

Share this post


Link to post
Share on other sites

Hi Ryuji, you can inset a polygon or polyline with these steps:

vector next = normalize( point(0, 'P', (@ptnum + 1) % @numpt) - v@P ); 
vector prev = normalize( v@P - point(0, 'P', (@ptnum - 1) % @numpt) ); 

vector avg  = normalize(next + prev);
vector up   = normalize( abs(cross(prev, avg)) );
vector in   = cross(avg, up);
float dist  = dot(next, avg);
vector dir  = in / dist;

v@P += dir * chf('extrude'); 

Kim Goossens discusses this here: https://www.youtube.com/watch?v=tnDqwcNG20Y

  • Like 1

Share this post


Link to post
Share on other sites

Hey Konstantin,

 

Thank you so much for this. It's really interesting.

I wanted to make a compilable version of polyextrude, but in the end, I used the polyextrude sop with local attributes (zscale, etc...).

My attempt at a compilable polyextrude was like 3 times slower than the normal one.

 

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

×