Vector.Multiply Operator

Definition

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

Overloads

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 vector structures and returns the result as a Double.

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.

C#
public static System.Windows.Vector operator *(System.Windows.Vector vector, System.Windows.Media.Matrix matrix);

Parameters

vector
Vector

The vector 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 operator (*) to multiply a Vector structure by a Matrix structure.

C#
private Vector overloadedMultiplyVectorByMatrixOperatorExample()
{
    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 = vector1 * matrix1;

    return vectorResult;
}

See also

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

Multiply(Vector, Vector)

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

C#
public static double operator *(System.Windows.Vector vector1, System.Windows.Vector vector2);

Parameters

vector1
Vector

The first vector to multiply.

vector2
Vector

The second vector to multiply.

Returns

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 operator (*) to multiply a Vector structure by a Vector.

C#
private Double overloadedOperatorGetDotProductExample()
{
    Vector vector1 = new Vector(20, 30);
    Vector vector2 = new Vector(45, 70);

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

    return doubleResult;
}

See also

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

Multiply(Double, Vector)

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

C#
public static System.Windows.Vector operator *(double scalar, System.Windows.Vector 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 operator (*) to multiply a scalar by a Vector structure.

C#
private Vector overloadedMultiplicationOperatorExample2()
{
    Vector vector1 = new Vector(20, 30);
    Double scalar1 = 75;

    // vectorResult is equal to (1500,2250)
    Vector vectorResult = scalar1 * vector1;

    return vectorResult;
}

See also

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

Multiply(Vector, Double)

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

C#
public static System.Windows.Vector operator *(System.Windows.Vector vector, double scalar);

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 operator (*) to multiply a Vector structure by a scalar.

C#
private Vector overloadedMultiplicationOperatorExample1()
{
    Vector vector1 = new Vector(20, 30);
    Double scalar1 = 75;

    // vectorResult is equal to (1500,2250)
    Vector vectorResult = vector1 * scalar1;

    return vectorResult;
}

See also

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10