clampValue method
Implementation
Vector2D clampValue(double min, double max) {
double length = lengthSqr;
if (length > 0.0) {
length = math.sqrt(length);
double scale = 1;
if (length < min) {
scale = min/length;
} else if (length > max) {
scale = max/length;
}
return this.scale(scale);
}
return this;
}