예제 #1
0
        public static float calcDimentionLinear(this GraphicBase line, float value, float y0, float y1)
        {
            float m = (y1 - y0) / (line.upperMagnitude - line.lowerMagnitude);
            float b = y1 - line.upperMagnitude * m;

            value = Mathf.Clamp(value, line.lowerMagnitude, line.upperMagnitude);
            return(value * m + b);
        }
예제 #2
0
        public static float calcDimentionExp(this GraphicBase line, float value, float y0, float y1)
        {
            /* exponential scaling makes changes near zero more noticeable */
            float T = 5 / line.upperMagnitude;
            float A = (y1 - y0) / Mathf.Exp(-line.lowerMagnitude * T);

            value = Mathf.Clamp(value, line.lowerMagnitude, line.upperMagnitude);
            return(y1 - A * Mathf.Exp(-value * T));
        }