clampLength method
If this vector's length is greater than the max value, the vector will be scaled down so its length is the max value.
If this vector's length is less than the min value, the vector will be scaled up so its length is the min value.
min- the minimum value the length will be clamped tomax- the maximum value the length will be clamped to
Implementation
Vector3 clampLength(double min, double max) {
var _length = length();
var _max = math.max(min, math.min(max, _length));
return divideScalar(_length).multiplyScalar(_max);
}