public FixedPointVector2 NormalizeWithClampedMagnitude(FixedPoint clamp) { var magnitude = MathFixedPoint.ClampMagnitude(this, clamp); if (magnitude > FixedPoint.Zero) { return(this / magnitude); } return(this); }
public FixedPointVector2 Normalize() { var magnitude = MathFixedPoint.Magnitude(this); if (magnitude.Equals(FixedPoint.Zero)) { return(Sign()); } return(this / magnitude); }
public static FixedPoint Distance(FixedPointVector2 v1, FixedPointVector2 v2) { return(MathFixedPoint.Sqrt(((v1.X - v2.X) ^ FixedPoint.Two) + ((v1.Y - v2.Y) ^ FixedPoint.Two))); }
public FixedPoint Length() { return(MathFixedPoint.Magnitude(this)); }
public FixedPointVector2 Sign() { return(new FixedPointVector2(MathFixedPoint.Sign(X), MathFixedPoint.Sign(Y))); }