コード例 #1
0
        /// <summary>
        /// Adds a control point to the curve.
        /// </summary>
        /// <param name="input">The curves input value.</param>
        /// <param name="output">The curves output value.</param>
        public void Add(double input, double output)
        {
            var kvp = new CurveControlPoint()
            {
                X = input,
                Y = output
            };

            if (!ControlPoints.Contains(kvp))
            {
                ControlPoints.Add(kvp);
            }

            ControlPoints.Sort(delegate(CurveControlPoint lhs, CurveControlPoint rhs)
            {
                return(lhs.X.CompareTo(rhs.X));
            });
        }
コード例 #2
0
ファイル: Curve.cs プロジェクト: modopotato/LibnoiseDesigner
        /// <summary>
        /// Adds a control point to the curve.
        /// </summary>
        /// <param name="input">The curves input value.</param>
        /// <param name="output">The curves output value.</param>
        public void Add(double input, double output)
        {
            var kvp = new CurveControlPoint()
            {
                X = input,
                Y = output
            };

            if (!ControlPoints.Contains(kvp))
            {
                ControlPoints.Add(kvp);
            }

            ControlPoints.Sort(delegate(CurveControlPoint lhs, CurveControlPoint rhs)
            {
                return lhs.X.CompareTo(rhs.X);
            });
        }