clampLength method

Vector2 clampLength(
  1. double min,
  2. double max
)

Implementation

Vector2 clampLength(double min, double max) {
  var length = this.length();

  return divideScalar(length)
      .multiplyScalar(Math.max(min, Math.min(max, length)));
}