public float interprolate(float first, float second, float interprolation, InterprolationStyle style = InterprolationStyle.Linear) { switch(style) { case InterprolationStyle.Linear: return ((second - first) * interprolation) + first; case InterprolationStyle.Sin: return ((second - first * (float)Math.Sin(interprolation)) * interprolation) + first; case InterprolationStyle.Sqrt: return ((second - first * (float)Math.Sqrt(interprolation)) * interprolation) + first; case InterprolationStyle.Cos: return ((second - first * (float)Math.Cos(interprolation)) * interprolation) + first; case InterprolationStyle.Sinh: return ((second - first * (float)Math.Sinh(interprolation)) * interprolation) + first; } throw new ArgumentException("IntprolationStyle \"style\" does not match any known InterprolationStyle."); }
public float interprolate(float first, float second, float interprolation, InterprolationStyle style = InterprolationStyle.Linear) { switch (style) { case InterprolationStyle.Linear: return(((second - first) * interprolation) + first); case InterprolationStyle.Sin: return(((second - first * (float)Math.Sin(interprolation)) * interprolation) + first); case InterprolationStyle.Sqrt: return(((second - first * (float)Math.Sqrt(interprolation)) * interprolation) + first); case InterprolationStyle.Cos: return(((second - first * (float)Math.Cos(interprolation)) * interprolation) + first); case InterprolationStyle.Sinh: return(((second - first * (float)Math.Sinh(interprolation)) * interprolation) + first); } throw new ArgumentException("IntprolationStyle \"style\" does not match any known InterprolationStyle."); }