예제 #1
0
 public Vector Add(Vector vector)
 {
     Vector result = new Vector();
     result.X = this.X + vector.X;
     result.Y = this.Y + vector.Y;
     return result;
 }
예제 #2
0
 public Vector Subtract(Vector vector)
 {
     Vector result = new Vector();
     result.X = this.X - vector.X;
     result.Y = this.Y - vector.Y;
     return result;
 }
예제 #3
0
 public Vector Reflect(Vector unitVector)
 {
     double dotProduct = this.Dot(unitVector);
     Vector reflection = unitVector.Multiply(2 * dotProduct).Subtract(this);
     return reflection;
 }
예제 #4
0
 public Vector Multiply(double scaleFactor)
 {
     Vector result = new Vector();
     result.X = this.X + scaleFactor;
     result.Y = this.Y + scaleFactor;
     return result;
 }
예제 #5
0
 public double Dot(Vector vector)
 {
     double result = 0.0f;
     result = this.X * vector.X + this.Y * vector.Y;
     return result;
 }