Search - User list
Full Version: Visualization Behind "Fit Range" VOP Node !!!
Root » Houdini Lounge » Visualization Behind "Fit Range" VOP Node !!!
papon
plz someone explain me the workings of fit range vop node and if it's possible plz share the mathematical formulae if it's helpful in visualization . keywords - “mechanics of fit range vop node”
CYTE
Hey papon,

“fit range” takes values from one range for example from -1 to +10 and “fits” them into a new range for example 0 to 1.
So a value that used to be -1 is 0 after the operation.

Cheers
CYTE
papon
CYTE
nge” takes values from
can you elaborate the mechanics behind it ? then it might be helpful .
tamte
papon
can you elaborate the mechanics behind it ? then it might be helpful .
it's just math so while I'm not sure what exact math is behind houdini fit function it will be along these lines
https://rosettacode.org/wiki/Map_range [rosettacode.org]

just note that fit() function (Fit Range VOP) returns clamped results while efit() function (Fit Range Unclamped VOP) will not clamp the results
Renji_kan
CYTE
Hey papon,

"fit range" takes values from one range for example from -1 to +10 and "fits" them into a new range for example 0 to 1.
So a value that used to be -1 is 0 after the operation.

Please tell me, where and how to look at the description of the FitRange nodes?
Here is a description on the site: https://www.sidefx.com/docs/houdini/nodes/vop/fit.html [www.sidefx.com]

But, I do not see a description of the Input parameters, what types they are and what the fit range node returns.
Is there such a description? or should I guess myself what the houdini developers did there?
Sidefx
vusta
here's a visualisation, I used VEX fit in a wrangle but it should be the same as a VOP (if you view the code in the VOP you'd see it calls vop_fit(), how you drill down further I don't know, you'd probably reach unreadable machine code)

Anyway, visually it remaps your min/max to newmin/newmax...

Adjust MinX, MaxX, NewMinX, NewMaxX and observe...try NewMinX = 4 and NewMaxX = -1 and you'll see it crosses over itself.

So here's my reverse engineering

mathematically: (it's just ratio)

x / (MaxX - MinX) = new x /(NewMaxX - NewMinX)

therefore, the fit is getting the new x value by:

new x = x * (NewMaxX - NewMinX) / (MaxX - MinX)

just my guess...don't sue me if your computer explodes.

ps: I'm quite confident on my logic as I had to write my own remap in MCG (hush....3dsMax!) and that's what I used..it worked fine I think.
vusta
ah, spotted a little detail, here's a file that has the fit and also the math
so in the math. I needed to offset between old and new starting points and that's it, switch between the fit and math nodes and they should be the same.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB