Esempio n. 1
0
 public static XY Project(XY v, XY w) => XY.Dot(v, w) / w.SqrLength * w;
Esempio n. 2
0
 public static float DirectionAngle(XY from, XY to) => (to - from).Angle;
Esempio n. 3
0
 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
     );
Esempio n. 4
0
 public static float SqrDistance(XY from, XY to) => (to - from).SqrLength;
Esempio n. 5
0
 public static float Distance(XY from, XY to) => (to - @from).Length;
Esempio n. 6
0
 public static float Cross(XY a, XY b) => a.X * b.Y - a.Y * b.X;
Esempio n. 7
0
 public static float Dot(XY a, XY b) => a.X * b.X + a.Y * b.Y;
Esempio n. 8
0
 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()));
 }