Vector.Multiply 运算符

定义

将指定 Vector 与指定 DoubleMatrixVector 相乘并返回结果。

重载

Multiply(Vector, Matrix)

使用指定的 Matrix 变换指定向量的坐标空间。

Multiply(Vector, Vector)

计算两个指定向量结构的点积并将结果以 Double 形式返回。

Multiply(Double, Vector)

将指定标量与指定向量相乘,并返回结果向量。

Multiply(Vector, Double)

将指定向量与指定标量相乘,并返回结果向量。

Multiply(Vector, Matrix)

使用指定的 Matrix 变换指定向量的坐标空间。

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

参数

vector
Vector

要转换的向量。

matrix
Matrix

要应用于 vector 的变换。

返回

Vector

vector 变换 matrix 的结果。

示例

以下示例演示如何使用此运算符 (*) 将结构乘MatrixVector结构。

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;
}
Private Function overloadedMultiplyVectorByMatrixOperatorExample() As Vector
    Dim vector1 As New Vector(20, 30)
    Dim matrix1 As New Matrix(40, 50, 60, 70, 80, 90)
    Dim vectorResult As New Vector()

    ' Multiply the vector and matrix.
    ' vectorResult is equal to (2600,3100).
    vectorResult = vector1 * matrix1

    Return vectorResult

End Function

另请参阅

适用于

Multiply(Vector, Vector)

计算两个指定向量结构的点积并将结果以 Double 形式返回。

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

参数

vector1
Vector

要相乘的第一个向量。

vector2
Vector

要相乘的第二个向量。

返回

Double

返回一个 Double,其中包含 vector1vector2 的标量点积,标量点积可通过下面的公式计算得出: vector1。X * vector2。X + vector1。Y * vector2。Y

示例

以下示例演示如何使用此运算符 (*) 将结构乘以一个 Vector Vector

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;
}
Private Function overloadedOperatorGetDotProductExample() As Double
    Dim vector1 As New Vector(20, 30)
    Dim vector2 As 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
    Dim doubleResult As Double = Vector.Multiply(vector1, vector2)

    Return doubleResult

End Function

另请参阅

适用于

Multiply(Double, Vector)

将指定标量与指定向量相乘,并返回结果向量。

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

参数

scalar
Double

要乘以的标量。

vector
Vector

要相乘的向量。

返回

Vector

scalarvector 相乘的结果。

示例

以下示例演示如何使用此运算符 (*) 将标量乘以 Vector 结构。

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

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

    return vectorResult;
}
Private Function overloadedMultiplicationOperatorExample2() As Vector
    Dim vector1 As New Vector(20, 30)
    Dim scalar1 As Double = 75

    ' vectorResult is equal to (1500,2250)
    Dim vectorResult As Vector = scalar1 * vector1

    Return vectorResult

End Function

另请参阅

适用于

Multiply(Vector, Double)

将指定向量与指定标量相乘,并返回结果向量。

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

参数

vector
Vector

要相乘的向量。

scalar
Double

要乘以的标量。

返回

Vector

vectorscalar 相乘的结果。

示例

以下示例演示如何使用此运算符 (*) 将结构乘以 Vector 标量。

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

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

    return vectorResult;
}
Private Function overloadedMultiplicationOperatorExample1() As Vector
    Dim vector1 As New Vector(20, 30)
    Dim scalar1 As Double = 75

    ' vectorResult is equal to (1500,2250)
    Dim vectorResult As Vector = vector1 * scalar1

    Return vectorResult

End Function

另请参阅

适用于