Vector.Multiply 方法

定义

将指定向量与指定的 DoubleMatrixVector 相乘并将结果以 VectorDouble 形式返回。Multiplies the specified vector by the specified Double, Matrix, or Vector and returns the result as a Vector or Double.

重载

Multiply(Double, Vector)

将指定标量与指定向量相乘,并返回结果 VectorMultiplies the specified scalar by the specified vector and returns the resulting Vector.

Multiply(Vector, Double)

将指定向量与指定标量相乘,并返回结果 VectorMultiplies the specified vector by the specified scalar and returns the resulting Vector.

Multiply(Vector, Matrix)

使用指定的 Matrix 变换指定向量的坐标空间。Transforms the coordinate space of the specified vector using the specified Matrix.

Multiply(Vector, Vector)

计算两个指定向量的点积并将结果以 Double 形式返回。Calculates the dot product of the two specified vectors and returns the result as a Double.

Multiply(Double, Vector)

将指定标量与指定向量相乘,并返回结果 VectorMultiplies 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

参数

scalar
Double

要乘以的标量。The scalar to multiply.

vector
Vector

要相乘的向量。The vector to multiply.

返回

scalarvector 相乘的结果。The result of multiplying scalar and vector.

示例

下面的示例演示如何使用此方法将标量Vector乘以。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;

}

另请参阅

Multiply(Vector, Double)

将指定向量与指定标量相乘,并返回结果 VectorMultiplies 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

参数

vector
Vector

要相乘的向量。The vector to multiply.

scalar
Double

要乘以的标量。The scalar to multiply.

返回

vectorscalar 相乘的结果。The result of multiplying vector and scalar.

示例

下面的示例演示如何使用此方法将与标量相乘VectorThe 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;

}

另请参阅

Multiply(Vector, Matrix)

使用指定的 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

参数

vector
Vector

要变换的向量结构。The vector structure to transform.

matrix
Matrix

要应用于 vector 的变换。The transformation to apply to vector.

返回

vector 变换 matrix 的结果。The result of transforming vector by matrix.

示例

下面的示例演示如何使用此方法将与相乘VectorMatrixThe 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;

}

另请参阅

Multiply(Vector, Vector)

计算两个指定向量的点积并将结果以 Double 形式返回。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

参数

vector1
Vector

要相乘的第一个向量。The first vector to multiply.

vector2
Vector

要相乘的第二个向量结构。The second vector structure to multiply.

返回

一个 Double,其中包含 vector1vector2 的标量点积,标量点积可通过下面的公式计算得出: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)(vector1.X * vector2.X) + (vector1.Y * vector2.Y)

示例

下面的示例演示如何使用此方法将与相乘VectorVectorThe 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;

}

另请参阅

适用于