Class Clamp

  • All Implemented Interfaces:
    EvaluatableExpression

    public class Clamp
    extends UnaryFunction
    Represents the clamp function in the Picasso language. Clamps color values to the range [-1, 1].
    • Constructor Detail

      • Clamp

        public Clamp​(ExpressionTreeNode param)
        Create a clamp expression tree that applies clamp() to the given parameter.
        Parameters:
        param - the expression whose values we will clamp
    • Method Detail

      • evaluate

        public RGBColor evaluate​(double x,
                                 double y)
        Evaluates this expression at (x, y) by clamping each RGB component to [-1, 1].
        Specified by:
        evaluate in interface EvaluatableExpression
        Specified by:
        evaluate in class ExpressionTreeNode
        Parameters:
        x - the value of x
        y - the value of y
        Returns:
        the result of evaluating the expression for the given values of x and y