Vector.Multiply 運算子
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
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
轉換 matrix
的結果。
範例
下列範例示範如何使用這個運算子 (*) ,將 結構乘 Vector 以 Matrix 結構。
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,包含 vector1
與 vector2
的純量點積,這是使用下列公式計算而來:
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
要相乘的向量。
傳回
scalar
和 vector
相乘的乘積。
範例
下列範例示範如何使用這個運算子 (*) 將純量乘以 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
和 scalar
相乘的乘積。
範例
下列範例示範如何使用這個運算子 (*) 將結構乘 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