efit in expression

   1368   2   0
User Avatar
Member
79 posts
Joined: Feb. 2008
Offline
I can use fit in an expression, but it clamps the values… so I want to use efit, but that doesn't seem to work in an expression.

I can work around the problem by using an attribute wrangle to store a detail attribute and then do a detail expression on the parameter I want, but that feels like an awkward solution. I'm wondering if there are better ways to do that?
User Avatar
Member
339 posts
Joined: June 2013
Offline
Sorry to hear about this, one way to curb it is to do your own expression and efit is fairly straight forward. So given the values:

value = 4

inmin = 1
inmax = 3

outmin = 6
outmax = 8


the expression (4-1)/(3-1)*(8-6)+6 will give you 9, because 9 is to the 6→8 range, as 4 is to the 1→3 range, if it was clamped it would be 8. In other venues this operation can be called map or remap or rescale.

You could file an RFE for the function.

Cheers
Edited by probiner - Sept. 19, 2019 18:51:20
User Avatar
Member
7762 posts
Joined: Sept. 2011
Offline
You can make your own custom expressions in a text file. The exread command in hscript is used to parse them in during startup.
  • Quick Links