-
Notifications
You must be signed in to change notification settings - Fork 0
constrain
Subhajit Sahu edited this page Aug 9, 2022
·
2 revisions
Constrain a number within a minimum and a maximum value.
function constrain(x, min, max)
// x: a number
// min: minimum value
// max: maximum value
const xnumber = require('extra-number');
xnumber.constrain(20, 0, 50);
// → 20
xnumber.constrain(-10, 0, 100);
// → 0
xnumber.constrain(120, 0, 100);
// → 100
- constrain(): Processing reference
- clamp package by Hugh Kennedy
- std::clamp: cppreference
- std.algorithm.comparison.clamp: D-lang documentation
- clamp(): raster package by R documentation
- Math.Clamp: .NET docs
- clamp: Direct3D HLSL
- clamp: OpenGL Reference pages
- Mathf.Clamp: Unity documentation
- Clamping (graphics): Wikipedia