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." );
}
}