public static XY Project(XY v, XY w) => XY.Dot(v, w) / w.SqrLength * w;
public static float DirectionAngle(XY from, XY to) => (to - from).Angle;
public static XY Lerp(XY pos0, XY pos1, float t) => new XY( pos0.X + (pos1.X - pos0.X) * t, pos0.Y + (pos1.Y - pos0.Y) * t );
public static float SqrDistance(XY from, XY to) => (to - from).SqrLength;
public static float Distance(XY from, XY to) => (to - @from).Length;
public static float Cross(XY a, XY b) => a.X * b.Y - a.Y * b.X;
public static float Dot(XY a, XY b) => a.X * b.X + a.Y * b.Y;
public static XY Shotgun1(XY dir, float cone, float minCoeff, float maxCoeff) { dir.Rotate(cone * _.Random.SignedFloat()); return(dir * Mathf.Lerp(minCoeff, maxCoeff, _.Random.Float())); }