docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method clamp

    clamp(int, int, int)

    Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are int values.

    Declaration
    public static int clamp(int valueToClamp, int lowerBound, int upperBound)
    Parameters
    Type Name Description
    int valueToClamp

    Input value to be clamped.

    int lowerBound

    Lower bound of the interval.

    int upperBound

    Upper bound of the interval.

    Returns
    Type Description
    int

    The clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(int2, int2, int2)

    Returns the result of a componentwise clamping of the int2 x into the interval [a, b], where a and b are int2 vectors.

    Declaration
    public static int2 clamp(int2 valueToClamp, int2 lowerBound, int2 upperBound)
    Parameters
    Type Name Description
    int2 valueToClamp

    Input value to be clamped.

    int2 lowerBound

    Lower bound of the interval.

    int2 upperBound

    Upper bound of the interval.

    Returns
    Type Description
    int2

    The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(int3, int3, int3)

    Returns the result of a componentwise clamping of the int3 x into the interval [a, b], where x, a and b are int3 vectors.

    Declaration
    public static int3 clamp(int3 valueToClamp, int3 lowerBound, int3 upperBound)
    Parameters
    Type Name Description
    int3 valueToClamp

    Input value to be clamped.

    int3 lowerBound

    Lower bound of the interval.

    int3 upperBound

    Upper bound of the interval.

    Returns
    Type Description
    int3

    The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(int4, int4, int4)

    Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are int4 vectors.

    Declaration
    public static int4 clamp(int4 valueToClamp, int4 lowerBound, int4 upperBound)
    Parameters
    Type Name Description
    int4 valueToClamp

    Input value to be clamped.

    int4 lowerBound

    Lower bound of the interval.

    int4 upperBound

    Upper bound of the interval.

    Returns
    Type Description
    int4

    The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(uint, uint, uint)

    Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are uint values.

    Declaration
    public static uint clamp(uint valueToClamp, uint lowerBound, uint upperBound)
    Parameters
    Type Name Description
    uint valueToClamp

    Input value to be clamped.

    uint lowerBound

    Lower bound of the interval.

    uint upperBound

    Upper bound of the interval.

    Returns
    Type Description
    uint

    The clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(uint2, uint2, uint2)

    Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are uint2 vectors.

    Declaration
    public static uint2 clamp(uint2 valueToClamp, uint2 lowerBound, uint2 upperBound)
    Parameters
    Type Name Description
    uint2 valueToClamp

    Input value to be clamped.

    uint2 lowerBound

    Lower bound of the interval.

    uint2 upperBound

    Upper bound of the interval.

    Returns
    Type Description
    uint2

    The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(uint3, uint3, uint3)

    Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are uint3 vectors.

    Declaration
    public static uint3 clamp(uint3 valueToClamp, uint3 lowerBound, uint3 upperBound)
    Parameters
    Type Name Description
    uint3 valueToClamp

    Input value to be clamped.

    uint3 lowerBound

    Lower bound of the interval.

    uint3 upperBound

    Upper bound of the interval.

    Returns
    Type Description
    uint3

    The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(uint4, uint4, uint4)

    Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are uint4 vectors.

    Declaration
    public static uint4 clamp(uint4 valueToClamp, uint4 lowerBound, uint4 upperBound)
    Parameters
    Type Name Description
    uint4 valueToClamp

    Input value to be clamped.

    uint4 lowerBound

    Lower bound of the interval.

    uint4 upperBound

    Upper bound of the interval.

    Returns
    Type Description
    uint4

    The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(long, long, long)

    Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are long values.

    Declaration
    public static long clamp(long valueToClamp, long lowerBound, long upperBound)
    Parameters
    Type Name Description
    long valueToClamp

    Input value to be clamped.

    long lowerBound

    Lower bound of the interval.

    long upperBound

    Upper bound of the interval.

    Returns
    Type Description
    long

    The clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(ulong, ulong, ulong)

    Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are ulong values.

    Declaration
    public static ulong clamp(ulong valueToClamp, ulong lowerBound, ulong upperBound)
    Parameters
    Type Name Description
    ulong valueToClamp

    Input value to be clamped.

    ulong lowerBound

    Lower bound of the interval.

    ulong upperBound

    Upper bound of the interval.

    Returns
    Type Description
    ulong

    The clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(float, float, float)

    Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are float values.

    Declaration
    public static float clamp(float valueToClamp, float lowerBound, float upperBound)
    Parameters
    Type Name Description
    float valueToClamp

    Input value to be clamped.

    float lowerBound

    Lower bound of the interval.

    float upperBound

    Upper bound of the interval.

    Returns
    Type Description
    float

    The clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(float2, float2, float2)

    Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are float2 vectors.

    Declaration
    public static float2 clamp(float2 valueToClamp, float2 lowerBound, float2 upperBound)
    Parameters
    Type Name Description
    float2 valueToClamp

    Input value to be clamped.

    float2 lowerBound

    Lower bound of the interval.

    float2 upperBound

    Upper bound of the interval.

    Returns
    Type Description
    float2

    The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(float3, float3, float3)

    Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are float3 vectors.

    Declaration
    public static float3 clamp(float3 valueToClamp, float3 lowerBound, float3 upperBound)
    Parameters
    Type Name Description
    float3 valueToClamp

    Input value to be clamped.

    float3 lowerBound

    Lower bound of the interval.

    float3 upperBound

    Upper bound of the interval.

    Returns
    Type Description
    float3

    The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(float4, float4, float4)

    Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are float4 vectors.

    Declaration
    public static float4 clamp(float4 valueToClamp, float4 lowerBound, float4 upperBound)
    Parameters
    Type Name Description
    float4 valueToClamp

    Input value to be clamped.

    float4 lowerBound

    Lower bound of the interval.

    float4 upperBound

    Upper bound of the interval.

    Returns
    Type Description
    float4

    The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(double, double, double)

    Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are double values.

    Declaration
    public static double clamp(double valueToClamp, double lowerBound, double upperBound)
    Parameters
    Type Name Description
    double valueToClamp

    Input value to be clamped.

    double lowerBound

    Lower bound of the interval.

    double upperBound

    Upper bound of the interval.

    Returns
    Type Description
    double

    The clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(double2, double2, double2)

    Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are double2 vectors.

    Declaration
    public static double2 clamp(double2 valueToClamp, double2 lowerBound, double2 upperBound)
    Parameters
    Type Name Description
    double2 valueToClamp

    Input value to be clamped.

    double2 lowerBound

    Lower bound of the interval.

    double2 upperBound

    Upper bound of the interval.

    Returns
    Type Description
    double2

    The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(double3, double3, double3)

    Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are double3 vectors.

    Declaration
    public static double3 clamp(double3 valueToClamp, double3 lowerBound, double3 upperBound)
    Parameters
    Type Name Description
    double3 valueToClamp

    Input value to be clamped.

    double3 lowerBound

    Lower bound of the interval.

    double3 upperBound

    Upper bound of the interval.

    Returns
    Type Description
    double3

    The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    clamp(double4, double4, double4)

    Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are double4 vectors.

    Declaration
    public static double4 clamp(double4 valueToClamp, double4 lowerBound, double4 upperBound)
    Parameters
    Type Name Description
    double4 valueToClamp

    Input value to be clamped.

    double4 lowerBound

    Lower bound of the interval.

    double4 upperBound

    Upper bound of the interval.

    Returns
    Type Description
    double4

    The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)