/// <summary> /// <para>Returns a copy of vector with its magnitude clamped to maxLength.</para> /// </summary> /// <param name="vector"></param> /// <param name="maxLength"></param> public static FixedVector2 ClampMagnitude(FixedVector2 vector, Fixed maxLength) { if (vector.sqrMagnitude > maxLength * maxLength) { return(vector.normalized * maxLength); } return(vector); }
public bool Equals(FixedVector2 other) { return(x == other.x && y == other.y); }
/// <summary> /// <para>Linearly interpolates between vectors a and b by t.</para> /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <param name="t"></param> public static FixedVector2 Lerp(FixedVector2 a, FixedVector2 b, Fixed t) { t = FixedMathf.Clamp01(t); return(new FixedVector2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t)); }
public static Fixed Dot(FixedVector2 lhs, FixedVector2 rhs) { return(lhs.x * rhs.x + lhs.y * rhs.y); }