Rediger

Del via


Vector.Multiply Method

Definition

Multiplies the specified vector by the specified Double, Matrix, or Vector and returns the result as a Vector or Double.

Overloads

Multiply(Double, Vector)

Multiplies the specified scalar by the specified vector and returns the resulting Vector.

Multiply(Vector, Double)

Multiplies the specified vector by the specified scalar and returns the resulting Vector.

Multiply(Vector, Matrix)

Transforms the coordinate space of the specified vector using the specified Matrix.

Multiply(Vector, Vector)

Calculates the dot product of the two specified vectors and returns the result as a Double.

Multiply(Double, Vector)

Multiplies the specified scalar by the specified vector and returns the resulting Vector.

public:
 static System::Windows::Vector Multiply(double scalar, System::Windows::Vector vector);
public static System.Windows.Vector Multiply (double scalar, System.Windows.Vector vector);
static member Multiply : double * System.Windows.Vector -> System.Windows.Vector
Public Shared Function Multiply (scalar As Double, vector As Vector) As Vector

Parameters

scalar
Double

The scalar to multiply.

vector
Vector

The vector to multiply.

Returns

The result of multiplying scalar and vector.

Examples

The following example shows how to use this method to multiply a scalar by a Vector.

private Vector multiplyVectorByScalarExample2()
{
    Vector vector1 = new Vector(20, 30);
    Double scalar1 = 75;
    Vector vectorResult = new Vector();

    // Multiply the vector by the scalar.
    // vectorResult is equal to (1500,2250)
    vectorResult = Vector.Multiply(scalar1, vector1);

    return vectorResult;
}

See also

Applies to

Multiply(Vector, Double)

Multiplies the specified vector by the specified scalar and returns the resulting Vector.

public:
 static System::Windows::Vector Multiply(System::Windows::Vector vector, double scalar);
public static System.Windows.Vector Multiply (System.Windows.Vector vector, double scalar);
static member Multiply : System.Windows.Vector * double -> System.Windows.Vector
Public Shared Function Multiply (vector As Vector, scalar As Double) As Vector

Parameters

vector
Vector

The vector to multiply.

scalar
Double

The scalar to multiply.

Returns

The result of multiplying vector and scalar.

Examples

The following example shows how to use this method to multiply a Vector by a scalar.

private Vector multiplyVectorByScalarExample1()
{
    Vector vector1 = new Vector(20, 30);
    Double scalar1 = 75;
    Vector vectorResult = new Vector();

    // Multiply the vector by the scalar.
    // vectorResult is equal to (1500,2250)
    vectorResult = Vector.Multiply(vector1, scalar1);

    return vectorResult;
}

See also

Applies to

Multiply(Vector, Matrix)

Transforms the coordinate space of the specified vector using the specified Matrix.

public:
 static System::Windows::Vector Multiply(System::Windows::Vector vector, System::Windows::Media::Matrix matrix);
public static System.Windows.Vector Multiply (System.Windows.Vector vector, System.Windows.Media.Matrix matrix);
static member Multiply : System.Windows.Vector * System.Windows.Media.Matrix -> System.Windows.Vector
Public Shared Function Multiply (vector As Vector, matrix As Matrix) As Vector

Parameters

vector
Vector

The vector structure to transform.

matrix
Matrix

The transformation to apply to vector.

Returns

The result of transforming vector by matrix.

Examples

The following example shows how to use this method to multiply a Vector by a Matrix.

private Vector multiplyVectorByMatrixExample()
{
    Vector vector1 = new Vector(20, 30);
    Matrix matrix1 = new Matrix(40, 50, 60, 70, 80, 90);
    Vector vectorResult = new Vector();

    // Multiply the vector and matrix.
    // vectorResult is equal to (2600,3100).
    vectorResult = Vector.Multiply(vector1, matrix1);

    return vectorResult;
}

See also

Applies to

Multiply(Vector, Vector)

Calculates the dot product of the two specified vectors and returns the result as a Double.

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

Parameters

vector1
Vector

The first vector to multiply.

vector2
Vector

The second vector structure to multiply.

Returns

A Double containing the scalar dot product of vector1 and vector2, which is calculated using the following formula:

(vector1.X * vector2.X) + (vector1.Y * vector2.Y)

Examples

The following example shows how to use this method to multiply a Vector by a Vector.

private Double getDotProductExample()
{
    Vector vector1 = new Vector(20, 30);
    Vector vector2 = new Vector(45, 70);
    Double doubleResult;

    // Return the dot product of the two specified vectors.
    // The dot product is calculated using the following 
    // formula: (vector1.X * vector2.X) + (vector1.Y * vector2.Y).
    // doubleResult is equal to 3000
    doubleResult = Vector.Multiply(vector1, vector2);

    return doubleResult;
}

See also

Applies to