//Let's j ust say if this vector is multiplied by a matrix it just uses the upper left 4 elements regardless of how big the matrix is public static Vector2X1 operator *(IMatrix M, Vector2X1 V) { Vector2X1 NewVect = new Vector2X1(); NewVect.X = M.Data[0, 0] * V.X + M.Data[0, 1] * V.Y; NewVect.Y = M.Data[1, 0] * V.X + M.Data[1, 1] * V.Y; return(NewVect); }
public static Matrix3X3 OutterProduct(Vector2X1 A, Vector2X1 B) { Matrix3X3 NewMatrix = new Matrix3X3(); NewMatrix.SetZeros(); NewMatrix.Data[0, 0] = A.X * B.X; NewMatrix.Data[0, 1] = A.X * B.Y; NewMatrix.Data[1, 0] = A.Y * B.X; NewMatrix.Data[1, 1] = A.Y * B.Y; return(NewMatrix); }
public override bool Equals(object obj) { // If parameter is null return false. if (obj == null) { return(false); } // If parameter cannot be cast to Vector2X1 return false. Vector2X1 v2 = obj as Vector2X1; if ((System.Object)v2 == null) { return(false); } //gotta test for NaN if (float.IsNaN(v2.X)) { return(false); } if (float.IsNaN(v2.Y)) { return(false); } //else have to check values if (Math.Abs(this.X - v2.X) > 1e-5) { return(false); } if (Math.Abs(this.Y - v2.Y) > 1e-5) { return(false); } //else return(true); }
public static float DotProduct(Vector2X1 U, Vector2X1 V) { return(U.X * V.X + U.Y * V.Y); }
public static double Distance(Vector2X1 v1, Vector2X1 v2) //EX: Vector2X1.Distance(Vect1, Vect2); { return(Math.Sqrt((v2.X - v1.X) * (v2.X - v1.X) + (v2.Y - v1.Y) * (v2.Y - v1.Y))); }
public Vector2X1(Vector2X1 oldVector) { X = oldVector.X; Y = oldVector.Y; }