clamp
Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are int values.
Read time 7 minutesLast updated 4 days ago
Definition
- Type: Method
- Namespace: Unity.Mathematics
- Assembly: UnityEngine.MathematicsModule
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.
public static int clamp(int valueToClamp, int lowerBound, int upperBound)
Parameters
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.
public static int2 clamp(int2 valueToClamp, int2 lowerBound, int2 upperBound)
Parameters
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.
public static int3 clamp(int3 valueToClamp, int3 lowerBound, int3 upperBound)
Parameters
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.
public static int4 clamp(int4 valueToClamp, int4 lowerBound, int4 upperBound)
Parameters
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.
public static uint clamp(uint valueToClamp, uint lowerBound, uint upperBound)
Parameters
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.
public static uint2 clamp(uint2 valueToClamp, uint2 lowerBound, uint2 upperBound)
Parameters
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.
public static uint3 clamp(uint3 valueToClamp, uint3 lowerBound, uint3 upperBound)
Parameters
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.
public static uint4 clamp(uint4 valueToClamp, uint4 lowerBound, uint4 upperBound)
Parameters
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.
public static long clamp(long valueToClamp, long lowerBound, long upperBound)
Parameters
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.
public static ulong clamp(ulong valueToClamp, ulong lowerBound, ulong upperBound)
Parameters
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.
public static float clamp(float valueToClamp, float lowerBound, float upperBound)
Parameters
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.
public static float2 clamp(float2 valueToClamp, float2 lowerBound, float2 upperBound)
Parameters
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.
public static float3 clamp(float3 valueToClamp, float3 lowerBound, float3 upperBound)
Parameters
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.
public static float4 clamp(float4 valueToClamp, float4 lowerBound, float4 upperBound)
Parameters
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.
public static double clamp(double valueToClamp, double lowerBound, double upperBound)
Parameters
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.
public static double2 clamp(double2 valueToClamp, double2 lowerBound, double2 upperBound)
Parameters
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.
public static double3 clamp(double3 valueToClamp, double3 lowerBound, double3 upperBound)
Parameters
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.
public static double4 clamp(double4 valueToClamp, double4 lowerBound, double4 upperBound)
Parameters
Returns
Type | Description |
|---|---|
| double4 | The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound]. |