vex levels with midpoint

   363   0   1
User Avatar
19 posts
Joined: 10月 2011
I'm trying to create a levels control out of an attribute wrangle. I have code that's doing something close to what I'm looking for but the midpoint isn't behaving right. I'm not really clear on what the math should be. Can anyone here help out?

Here's my existing code:

f@levelsResult = pow(fit(@attribute, chf("inMin"), chf("inMax"), chf("outMin"), chf("outMax")), 1.0 / chf("midPoint"));

UPDATE: I've a better, though not yet perfect, solution now. Unfortunately, the default values are a little more contrasty than they should be and it kicks out values above 1. Other than that though, the following code provides a tool that functions as I expect. That said, if any of you are able to provide me with a solution that works better, I'd really rather use that.

NOTE: I left in the esoteric naming this time.

float levelsMidpoint_rootToTip = 1 - chf("rootToTip_midPoint");
@stiffnessProfilePerFeatherRootToTip = pow(fit(@distanceFromRoot, chf("rootToTip_inMin"), chf("rootToTip_inMax"), chf("rootToTip_outMin"), chf("rootToTip_outMax")) + levelsMidpoint_rootToTip, (1.0 / levelsMidpoint_rootToTip)) * (levelsMidpoint_rootToTip);
Edited by fbb - 2023年5月28日 16:39:56
  • Quick Links