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