Jump to content

fit range unclamped vex?


Recommended Posts

If you r.click on your vopnet with the unclamped fit and choose 'vex/vop options->view vex code', you can see that the vex equivalent is efit().

If you try this in a wrangle, it comes back as undefined. Hmm.

Reason for this is that its not part of the standard vex calls, but in an extra library. Looking near the top of the generated vex code from the vopnet, can see that it includes 3 files:

 

#include <voptype.h>
#include <voplib.h>
#include <pyro_math.h>

 

Pasting those into a wrangle will make the efit function work again.

 

May as well take this journey to its logical conclusion though!

 

I commented out each line in turn until the function stopped working, that let me know that efit() is defined in pyro_math.h. (So if you wanted you could reduce the above includes to only that line.)

Getting into the houdini installation folder and searching for that file, I found it in $HFS/houdini/vex/include/ . Opening it in a text editor and searching for efit, can find exactly how its defined:

float efit(float val, s0,s1, t0,t1) {
   return (val-s0)*(t1-t0)/(s1-s0) + t0;
}

(as well as equivalents for other data types)

So if you wanted to define it yourself, that's how. The include is easier. :)

-matt

 

Edited by mestela
  • Like 4
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...