Option Explicit
Const Pi = 245850922 / 78256779, Pi×2 = Pi * 2
Function IntpoCyc(ByVal X As Double, ByVal X1 As Double, ByVal Y1 As Double, _
ByVal X2 As Double, ByVal Y2 As Double) As Double
IntpoCyc = Y1 + (Y2 - Y1) * Cyclo((X - X1) / (X2 - X1))
End Function
Function Cyclo(ByVal X As Double) As Double
Cyclo = Borné(0, X - Sin(X * Pi×2) / Pi×2, 1)
End Function
Function IntpoRal(ByVal X As Double, ByVal X1 As Double, ByVal Y1 As Double, _
ByVal X2 As Double, ByVal Y2 As Double) As Double
IntpoRal = Y1 + (Y2 - Y1) * CycRal((X - X1) / (X2 - X1))
End Function
Function CycRal(ByVal X As Double) As Double
CycRal = Min(X * 2, X + Sin(X * Pi) / Pi, 1)
End Function
Function IntpoAcc(ByVal X As Double, ByVal X1 As Double, ByVal Y1 As Double, _
ByVal X2 As Double, ByVal Y2 As Double) As Double
IntpoAcc = Y1 + (Y2 - Y1) * CycAcc((X - X1) / (X2 - X1))
End Function
Function CycAcc(ByVal X As Double) As Double
CycAcc = Max(0, X - Sin(X * Pi) / Pi, X * 2 - 1)
End Function
Function CycloDrv(ByVal X As Double) As Double
CycloDrv = 1 - Cos(X * Pi×2)
End Function
Private Function Borné(ByVal MxInf As Double, ByVal V As Double, ByVal MnSup As Double) As Double
Borné = (MxInf + Abs(V - MxInf) - Abs(MnSup - V) + MnSup) / 2
End Function
Function Min(ByVal Vr As Double, ParamArray Vs() As Variant) As Double
Dim N As Long: For N = 0 To UBound(Vs): If Vs(N) < Vr Then Vr = Vs(N)
Next N: Min = Vr: End Function
Function Max(ByVal Vr As Double, ParamArray Vs() As Variant) As Double
Dim N As Long: For N = 0 To UBound(Vs): If Vs(N) > Vr Then Vr = Vs(N)
Next N: Max = Vr: End Function