コード例 #1
0
 /// <summary>
 /// Set the ith column from avector.
 /// </summary>
 public void SetColumn(int iCol, Vector2f v)
 {
     this[0, iCol] = v.x;
     this[1, iCol] = v.y;
 }
コード例 #2
0
 /// <summary>
 /// Set the ith row from avector.
 /// </summary>
 public void SetRow(int iRow, Vector2f v)
 {
     this[iRow, 0] = v.x;
     this[iRow, 1] = v.y;
 }
コード例 #3
0
ファイル: Vector2f.cs プロジェクト: belzecue/Common
 /// <summary>
 /// The maximum value between each component in vectors.
 /// </summary>
 public void Max(Vector2f v)
 {
     x = Math.Max(x, v.x);
     y = Math.Max(y, v.y);
 }
コード例 #4
0
ファイル: Vector2f.cs プロジェクト: belzecue/Common
 /// <summary>
 /// Clamp the each component to specified min and max.
 /// </summary>
 public void Clamp(Vector2f min, Vector2f max)
 {
     x = Math.Max(Math.Min(x, max.x), min.x);
     y = Math.Max(Math.Min(y, max.y), min.y);
 }
コード例 #5
0
ファイル: Vector2f.cs プロジェクト: belzecue/Common
 /// <summary>
 /// The minimum value between each component in vectors.
 /// </summary>
 public void Min(Vector2f v)
 {
     x = Math.Min(x, v.x);
     y = Math.Min(y, v.y);
 }
コード例 #6
0
ファイル: Vector2f.cs プロジェクト: belzecue/Common
 /// <summary>
 /// Distance between two vectors.
 /// </summary>
 public static float Distance(Vector2f v0, Vector2f v1)
 {
     return(FMath.SafeSqrt(SqrDistance(v0, v1)));
 }
コード例 #7
0
ファイル: Vector2f.cs プロジェクト: belzecue/Common
 /// <summary>
 /// Cross two vectors.
 /// </summary>
 public static float Cross(Vector2f v0, Vector2f v1)
 {
     return(v0.x * v1.y - v0.y * v1.x);
 }
コード例 #8
0
ファイル: Vector2f.cs プロジェクト: belzecue/Common
 /// <summary>
 /// The dot product of two vectors.
 /// </summary>
 public static float Dot(Vector2f v0, Vector2f v1)
 {
     return(v0.x * v1.x + v0.y * v1.y);
 }
コード例 #9
0
ファイル: Vector2f.cs プロジェクト: belzecue/Common
 /// <summary>
 /// Are these vectors equal.
 /// </summary>
 public bool Equals(Vector2f v)
 {
     return(this == v);
 }