This takes a number between 0 and 1 and applies a smoothing to it (still increasing and between 0 and 1) so that the resulting function is smooth and has first and second derivatives 0 at the endpoints (0 and 1). The formula itself is 6t^5 - 15t^4 + 10t^3 - CSharp System

CSharp examples for System:Math Number

Description

This takes a number between 0 and 1 and applies a smoothing to it (still increasing and between 0 and 1) so that the resulting function is smooth and has first and second derivatives 0 at the endpoints (0 and 1). The formula itself is 6t^5 - 15t^4 + 10t^3

Demo Code


using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;// ww w .  j  av  a 2  s  . c  om

public class Main{
        /// <summary>
        /// This takes a number between 0 and 1 and applies
        /// a smoothing to it (still increasing and between 0 and 1)
        /// so that the resulting function is smooth and has
        /// first and second derivatives 0 at the endpoints (0 and 1).
        /// 
        /// The formula itself is 6t^5 - 15t^4 + 10t^3
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public static float QuinticScale(float t)
        {
            return ((6 * t - 15) * t + 10) * t * t * t;
        }
}

Related Tutorials