/// <summary>
        /// 補間生成
        /// </summary>
        /// <param name="left"></param>
        /// <param name="leftKey"></param>
        /// <param name="right"></param>
        /// <param name="rightKey"></param>
        /// <returns></returns>
        protected override ReadOnlyCollection <ValueBase> Interpolate(
            ValueBase left, int leftKey,
            ValueBase right, int rightKey)
        {
            Value leftValue  = (Value)left;
            Value rightValue = (Value)right;

            int count = rightKey - leftKey - 1;
            List <ValueBase> results = new List <ValueBase>(count);

            // 間のフレームの補間を生み出す
            Interpolater interporator = Interpolater.GetInterpolater(leftValue.ipType);

            for (int i = 0; i < count; ++i)
            {
                float value = interporator.Interpolate(
                    leftValue.value, rightValue.value,
                    leftKey, rightKey, i + leftKey + 1);
                results.Add(new Value()
                {
                    ipType = leftValue.ipType,
                    value  = value,
                });
            }
            return(results.AsReadOnly());
        }
Beispiel #2
0
        /// <summary>
        /// 補間
        /// </summary>
        /// <param name="left"></param>
        /// <param name="leftKey"></param>
        /// <param name="right"></param>
        /// <param name="rightKey"></param>
        /// <returns></returns>
        protected override ReadOnlyCollection <ValueBase> Interpolate(
            ValueBase left, int leftKey, ValueBase right, int rightKey)
        {
            Value leftValue  = (Value)left;
            Value rightValue = (Value)right;

            int count = rightKey - leftKey - 1;
            List <ValueBase> results = new List <ValueBase>(count);

            // 間のフレームの補間を生み出す
            Interpolater interporator = Interpolater.GetInterpolater("linear");

            for (int i = 0; i < count; ++i)
            {
                float[] lt = interporator.Interpolate(leftValue.lt, rightValue.lt, leftKey, rightKey, i + leftKey + 1);
                float[] rt = interporator.Interpolate(leftValue.rt, rightValue.rt, leftKey, rightKey, i + leftKey + 1);
                float[] lb = interporator.Interpolate(leftValue.lb, rightValue.lb, leftKey, rightKey, i + leftKey + 1);
                float[] rb = interporator.Interpolate(leftValue.rb, rightValue.rb, leftKey, rightKey, i + leftKey + 1);
                results.Add(new Value()
                {
                    lt = lt,
                    rt = rt,
                    lb = lb,
                    rb = rb
                });
            }
            return(results.AsReadOnly());
        }