normalized method
Normalized copy of this.
Implementation
Vector2 normalized() {
final length = this.length;
if (length == 0) return .new(x, y);
final scale = 1 / length;
return .new(x * scale, y * scale);
}
Normalized copy of this.
Vector2 normalized() {
final length = this.length;
if (length == 0) return .new(x, y);
final scale = 1 / length;
return .new(x * scale, y * scale);
}