AForge.Fuzzy.PiecewiseLinearFunction.PiecewiseLinearFunction C# (CSharp) Method

PiecewiseLinearFunction() public method

Initializes a new instance of the PiecewiseLinearFunction class.

Specified point must be in crescent order on X axis and their Y value must be in the range of [0, 1].

Points must be in crescent order on X axis. Y value of points must be in the range of [0, 1].
public PiecewiseLinearFunction ( Point points ) : System
points Point Array of (X,Y) coordinates of each start/end of the lines.
return System
        public PiecewiseLinearFunction( Point[] points )
        {
            this.points = points;

            // check if X points are in a sequence and if Y values are in [0..1] range
            for ( int i = 0, n = points.Length; i < n; i++ )
            {
                if ( ( points[i].Y < 0 ) || ( points[i].Y > 1 ) )
                    throw new ArgumentException( "Y value of points must be in the range of [0, 1]." );

                if ( i == 0 )
                    continue;

                if ( points[i - 1].X > points[i].X )
                    throw new ArgumentException( "Points must be in crescent order on X axis." );
            }
        }

Same methods

PiecewiseLinearFunction::PiecewiseLinearFunction ( ) : System