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.

Juzwa

vex funtion: XYZ dimentions of a sop

Hi, 

I guess this is easy question. I ahve a Bound sop and I want to get its xyz dimentions. What is a vex function for getting sop dimentions? I've been trying to look into help  but Im not getting lucky.

Edited by Juzwa

Share this post


Link to post
Share on other sites

Try getbbox function.

// Point wrangle.
vector min, max;
getbbox(0, min, max);

To visualize:

addpoint(0, min);
addpoint(0, max);

 

Share this post


Link to post
Share on other sites

Just as an addendum, the very useful bbox functions work in wrangles. E.g

ysize = `bbox(0, D_YSIZE)`;

Will give you the size of the bound box in the y axis  

 

Share this post


Link to post
Share on other sites
3 hours ago, vtrvtr said:

Just as an addendum, the very useful bbox functions work in wrangles. E.g


ysize = `bbox(0, D_YSIZE)`;

Will give you the size of the bound box in the y axis  

 

It's very important to understand why that appears to "work". Your example uses an expression function that's evaluated while evaluating the string parameter for the wrangle's code. This happens before the VEX code is compiled, and means that the VEX code will keep being recompiled whenever the value is dirtied by the upstream SOP's geometry changing. That can have significant overhead, such as when running inside a foreach loop.

2 people like this

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