コード例 #1
0
 public static Vector2d Max(Vector2d lhs, Vector2d rhs)
 {
     return(new Vector2d(Mathd.Max(lhs.x, rhs.x), Mathd.Max(lhs.y, rhs.y)));
 }
コード例 #2
0
 public static double Distance(Vector2d a, Vector2d b)
 {
     return((a - b).magnitude);
 }
コード例 #3
0
 public static double SqrMagnitude(Vector2d a)
 {
     return(a.x * a.x + a.y * a.y);
 }
コード例 #4
0
 public static double Angle(Vector2d from, Vector2d to)
 {
     return(Mathd.Acos(Mathd.Clamp(Dot(from.normalized, to.normalized), -1d, 1d)) * 57.29578d);
 }
コード例 #5
0
 public static double Dot(Vector2d lhs, Vector2d rhs)
 {
     return(lhs.x * rhs.x + lhs.y * rhs.y);
 }
コード例 #6
0
 public void Scale(Vector2d scale)
 {
     x *= scale.x;
     y *= scale.y;
 }
コード例 #7
0
 public static Vector2d Scale(Vector2d a, Vector2d b)
 {
     return(new Vector2d(a.x * b.x, a.y * b.y));
 }
コード例 #8
0
 public static Vector2d Lerp(Vector2d from, Vector2d to, double t)
 {
     t = Mathd.Clamp01(t);
     return(new Vector2d(from.x + (to.x - from.x) * t, from.y + (to.y - from.y) * t));
 }