Vector.Add Vector.Add Vector.Add Vector.Add Method

Definition

Adds a vector to a point or to another vector.

Overloads

Add(Vector, Point) Add(Vector, Point) Add(Vector, Point)

Translates the specified point by the specified vector and returns the resulting point.

Add(Vector, Vector) Add(Vector, Vector) Add(Vector, Vector) Add(Vector, Vector)

Adds two vectors and returns the result as a Vector structure.

Add(Vector, Point) Add(Vector, Point) Add(Vector, Point)

Translates the specified point by the specified vector and returns the resulting point.

public:
 static System::Windows::Point Add(System::Windows::Vector vector, System::Windows::Point point);
public static System.Windows.Point Add (System.Windows.Vector vector, System.Windows.Point point);
static member Add : System.Windows.Vector * System.Windows.Point -> System.Windows.Point

Parameters

vector
Vector Vector Vector Vector

The amount to translate the specified point.

point
Point Point Point Point

The point to translate.

Returns

The result of translating point by vector.

Examples

The following example shows how to use this method to add a Point structure to a Vector structure.

private Point addPointAndVectorExample()
{
    Vector vector1 = new Vector(20, 30);
    Point point1 = new Point(10, 5);
    Point pointResult = new Point();

    // Add Point and Vector together.
    // pointResult is equal to (30,35).
    pointResult = Vector.Add(vector1, point1);

    return pointResult;

}
See also

Add(Vector, Vector) Add(Vector, Vector) Add(Vector, Vector) Add(Vector, Vector)

Adds two vectors and returns the result as a Vector structure.

public:
 static System::Windows::Vector Add(System::Windows::Vector vector1, System::Windows::Vector vector2);
public static System.Windows.Vector Add (System.Windows.Vector vector1, System.Windows.Vector vector2);
static member Add : System.Windows.Vector * System.Windows.Vector -> System.Windows.Vector
Public Shared Function Add (vector1 As Vector, vector2 As Vector) As Vector

Parameters

vector1
Vector Vector Vector Vector

The first vector to add.

vector2
Vector Vector Vector Vector

The second vector to add.

Returns

The sum of vector1 and vector2.

Examples

The following example shows how to use this method to add two Vector structures.

private Vector addTwoVectorsExample()
{
    // Create two Vector structures.
    Vector vector1 = new Vector(20, 30);
    Vector vector2 = new Vector(45, 70);
    Vector vectorResult = new Vector();

    // Add the vectors together. 
    // vectorResult is equal to (65, 100).
    vectorResult = Vector.Add(vector1, vector2);

    return vectorResult;

}
See also

Applies to