Class LinearFunction


  • public class LinearFunction
    extends Object
    A linear function is a function that is defined by straight line segments between a series of points. If there are no points, the function is defined by the straight horizontal line y = 0. If there is one point, the function is defined by the straight horizontal line through that point. If there are two or more points, the function value of a point between the first point and the last point is defined by the line segment between two points. For points before the first point, the value is defined by extending the first line segment (between the first and second point). For points after the last point, the value is defined by extending the last line segment.
    • Constructor Detail

      • LinearFunction

        public LinearFunction()
        Constructs a new linear function without any points.
    • Method Detail

      • addPoint

        public void addPoint​(float x,
                             float y)
        Adds a point.
        Parameters:
        x - the X value
        y - the Y value
      • get

        public float get​(float x)
        Returns the function value for the specified point.
        Parameters:
        x - the point
        Returns:
        the function value