Math Question for S-Curve

For a transform, I need to have a user defined s-curve, that can be controlled using sliders.
For the first half I have been able to create the correct formula,
but I can’t get the second part of the curve to have the correct behaviour.
Is there anyone with a good Math brain that can get the second part of the formula to work?

Now, the lower left of the curve (x<0.5) behaves as I would like,
but the upper right (n>0.5) is fixed,
and I would like to have the s-curve react in the same way to changes in s and e as the other part.

[code]dim p as new Picture(300,300,32)
dim x as double
dim y as double

// s is a double in the range of 0 to 1
// e is a double in the range of 1 to 5
// Both controlled by sliders

for n as double =0 to 1 step 0.005
if n<0.5 then
y=((1-s)x + s0.5*(x/0.5)^e) // This is the left part which works well
y=1-(1-x)^22 // this should mimic the behavior of the lower-left part of the curve

// Canvas1 is 300x300 pixels[/code]

If I understand correctly what you want to achieve (a curve symmetric with respect to the point at n=0.5, right?), this should work:

Dim z as Double z=1-n if n<0.5 then y=((1-s)*x + s*0.5*(x/0.5)^e) // This is the left part which works well else y=1-((1-s)*z + s*0.5*(z/0.5)^e) // Use z here end

Is that what you are after?


@Julen Ibarretxe Uriguen : You’re a life saver, thank you!