コード例 #1
0
ファイル: CurveUtils.cs プロジェクト: BeRo1985/LevelEditor
 /// <summary>
 /// Creates a curve evaluator for a curve</summary>
 /// <param name="curve">Curve</param>
 /// <returns>Curve evaluator</returns>
 /// <remarks>A curve evaluator calculates y-coordinates from x-coordinates using appropriate interpolation for a curve</remarks>
 public static ICurveEvaluator CreateCurveEvaluator(ICurve curve)
 {
     ICurveEvaluator cv = null;
     if (curve.CurveInterpolation == InterpolationTypes.Linear)
         cv = new LinearCurveEvaluator(curve);
     else if (curve.CurveInterpolation == InterpolationTypes.Hermite)
         cv = new HermiteCurveEvaluator(curve);
     else
         throw new NotImplementedException("CurveEvaluator not implement for "
             + curve.CurveInterpolation);
     return cv;
 }
コード例 #2
0
        /// <summary>
        /// Creates a curve evaluator for a curve</summary>
        /// <param name="curve">Curve</param>
        /// <returns>Curve evaluator</returns>
        /// <remarks>A curve evaluator calculates y-coordinates from x-coordinates using appropriate interpolation for a curve</remarks>
        public static ICurveEvaluator CreateCurveEvaluator(ICurve curve)
        {
            ICurveEvaluator cv = null;

            if (curve.CurveInterpolation == InterpolationTypes.Linear)
            {
                cv = new LinearCurveEvaluator(curve);
            }
            else if (curve.CurveInterpolation == InterpolationTypes.Hermite)
            {
                cv = new HermiteCurveEvaluator(curve);
            }
            else
            {
                throw new NotImplementedException("CurveEvaluator not implement for "
                                                  + curve.CurveInterpolation);
            }
            return(cv);
        }