Clamp¶
| Name | Mandatory | Description | Default | Type | 
|---|---|---|---|---|
| ⬅️ Input | The value to clamp. | IntInt2Int3Int4Int8Int16FloatFloat2Float3Float4Color | ||
| Output ➡️ | The clamped value. | IntInt2Int3Int4Int8Int16FloatFloat2Float3Float4Color | ||
| Min | No | The lower bound of the range | none | IntVar(Int)Int2Var(Int2)Int3Var(Int3)Int4Var(Int4)Int8Var(Int8)Int16Var(Int16)FloatVar(Float)Float2Var(Float2)Float3Var(Float3)Float4Var(Float4)ColorVar(Color)[Any]Var([Any]) | 
| Max | No | The upper bound of the range | none | IntVar(Int)Int2Var(Int2)Int3Var(Int3)Int4Var(Int4)Int8Var(Int8)Int16Var(Int16)FloatVar(Float)Float2Var(Float2)Float3Var(Float3)Float4Var(Float4)ColorVar(Color)[Any]Var([Any]) | 
This shard ensures the input value falls within the specified range. If the value falls below the minimum, the Min value is returned. If the value exceeds the maximum, the Max value is returned. Otherwise, the value is returned unchanged.
Details¶
This shard can accept integer or float vectors as input.
The input type and the type provided in the Min and Max parameters must be the same. (eg. if the input is a vector, the Min and Max parameters must be a vector of the same type)
The input vector and the Min and Max vector must be of the same length.
If the shard is comparing vectors, it will clamp each corresponding element in the input vector with the corresponding element in the Min and Max.
Consider the following example:
@i2(2 5)
  Clamp(Min: @i2(3 3) Max: @i2(4 4))
  Log("Result")
@i2(3 4). The first element in the input vector is 2, which is less than the first element in the Min vector (3), so it is clamped to 3. The second element in the input vector is 5, which is greater than the second element in the Max vector (4), so it is clamped to 4. It will process the Min parameter first and then the Max parameter.