public void Reflect(Vector2D normal) { Vector2D reflectiveVector = 2.0 * GetDotProduct(normal) * normal.GetReverse(); _x += reflectiveVector.X; _y += reflectiveVector.Y; }
public void Reflect(Vector2D normal) { Vector2D temp = new Vector2D(this); temp += 2.0 * GetDotProduct(normal) * normal.GetReverse(); // copy calculated values over x = temp.x; y = temp.y; }