Vector3D Vector3D Vector3D Vector3D Struct

定義

表示 3-D 空間中的移動。Represents a displacement in 3-D space.

public value class Vector3D : IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.Media.Media3D.Vector3DConverter))]
[System.Serializable]
public struct Vector3D : IFormattable
type Vector3D = struct
    interface IFormattable
Public Structure Vector3D
Implements IFormattable
繼承
屬性
實作

範例

這個範例示範如何使用多Vector3D載減法 (-) 運算子和Vector3D靜態Subtract方法來減去結構。This example shows how to subtract Vector3D structures using the overloaded subtraction (-) operator and the Vector3D static Subtract method.

下列程式碼顯示如何使用Vector3D減法方法。The following code shows how to use the Vector3D subtraction methods. 首先, Vector3D會具現化結構。First, the Vector3D structures are instantiated. 使用多載 (-) 運算子來扣除Subtract 結構,然後使用靜態方法來減去它們。Vector3DThe Vector3D structures are subtracted using the overloaded (-) operator, and then they are subtracted using the static Subtract method.

// Subtracts two 3-D Vectors using the Subtract method and -

// Declaring vector1 and initializing x,y,z values
Vector3D vector1 = new Vector3D(20, 30, 40);

// Declaring vector2 without initializing x,y,z values
Vector3D vector2 = new Vector3D();

// Assigning values to vector2
vector2.X = 45;
vector2.Y = 70;
vector2.Z = 80;

// Subtracting vectors using overload - operator
Vector3D vectorResult1 = new Vector3D();
vectorResult1 = vector1 - vector2;
// vectorResult1 is equal to (-25, -40, -40)

// Subtracting vectors using static Subtract method
Vector3D vectorResult2 = new Vector3D();
vectorResult2 = Vector3D.Subtract(vector1, vector2);
// vector2 is equal to (-25, -40, -40)

備註

XAML Attribute UsageXAML Attribute Usage

<object property="x,y,z"/>  
-or  
<object property="x y z"/>  

XAML 值XAML Values

xx
這個 X 結構的 Vector3D 元件。The X component of this Vector3D structure.

yy
這個 Y 結構的 Vector3D 元件。The Y component of this Vector3D structure.

zz
這個 Z 結構的 Vector3D 元件。The Z component of this Vector3D structure.

建構函式

Vector3D(Double, Double, Double) Vector3D(Double, Double, Double) Vector3D(Double, Double, Double) Vector3D(Double, Double, Double)

初始化 Vector3D 結構的新執行個體。Initializes a new instance of a Vector3D structure.

屬性

Length Length Length Length

取得這個 Vector3D 結構的長度。Gets the length of this Vector3D structure.

LengthSquared LengthSquared LengthSquared LengthSquared

取得這個 Vector3D 結構的長度平方。Gets the square of the length of this Vector3D structure.

X X X X

取得或設定這個 X 結構的 Vector3D 元件。Gets or sets the X component of this Vector3D structure.

Y Y Y Y

取得或設定這個 Y 結構的 Vector3D 元件。Gets or sets the Y component of this Vector3D structure.

Z Z Z Z

取得或設定這個 Z 結構的 Vector3D 元件。Gets or sets the Z component of this Vector3D structure.

方法

Add(Vector3D, Point3D) Add(Vector3D, Point3D) Add(Vector3D, Point3D) Add(Vector3D, Point3D)

依指定的 Point3D 結構平移指定的 Vector3D 結構,並傳回結果做為 Point3D 結構。Translates the specified Point3D structure by the specified Vector3D structure and returns the result as a Point3D structure.

Add(Vector3D, Vector3D) Add(Vector3D, Vector3D) Add(Vector3D, Vector3D) Add(Vector3D, Vector3D)

將兩個 Vector3D 結構相加,並傳回結果做為 Vector3D 結構。Adds two Vector3D structures and returns the result as a Vector3D structure.

AngleBetween(Vector3D, Vector3D) AngleBetween(Vector3D, Vector3D) AngleBetween(Vector3D, Vector3D) AngleBetween(Vector3D, Vector3D)

擷取將第一個指定的 Vector3D 結構旋轉至第二個指定的 Vector3D 結構所需的角度。Retrieves the angle required to rotate the first specified Vector3D structure into the second specified Vector3D structure.

CrossProduct(Vector3D, Vector3D) CrossProduct(Vector3D, Vector3D) CrossProduct(Vector3D, Vector3D) CrossProduct(Vector3D, Vector3D)

計算兩個 Vector3D 結構的叉積。Calculates the cross product of two Vector3D structures.

Divide(Vector3D, Double) Divide(Vector3D, Double) Divide(Vector3D, Double) Divide(Vector3D, Double)

將指定的 Vector3D 結構除以指定的純量,並傳回結果做為 Vector3DDivides the specified Vector3D structure by the specified scalar and returns the result as a Vector3D.

DotProduct(Vector3D, Vector3D) DotProduct(Vector3D, Vector3D) DotProduct(Vector3D, Vector3D) DotProduct(Vector3D, Vector3D)

計算兩個 Vector3D 結構的點積。Calculates the dot product of two Vector3D structures.

Equals(Vector3D, Vector3D) Equals(Vector3D, Vector3D) Equals(Vector3D, Vector3D) Equals(Vector3D, Vector3D)

比較兩個 Vector3D 結構是否相等。Compares two Vector3D structures for equality.

Equals(Vector3D) Equals(Vector3D) Equals(Vector3D) Equals(Vector3D)

比較兩個 Vector3D 結構是否相等。Compares two Vector3D structures for equality.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否為 Vector3D 結構,以及指定之 XYZObject 屬性是否等於這個 X 結構的 YZVector3D 屬性。Determines whether the specified object is a Vector3D structure and whether the X, Y, and Z properties of the specified Object are equal to the X, Y, and Z properties of this Vector3D structure.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

取得這個 Vector3D 結構的雜湊程式碼。Gets a hash code for this Vector3D structure.

Multiply(Double, Vector3D) Multiply(Double, Vector3D) Multiply(Double, Vector3D) Multiply(Double, Vector3D)

將指定的純量乘以指定的 Vector3D 結構,並傳回結果做為 Vector3DMultiplies the specified scalar by the specified Vector3D structure and returns the result as a Vector3D.

Multiply(Vector3D, Double) Multiply(Vector3D, Double) Multiply(Vector3D, Double) Multiply(Vector3D, Double)

將指定的 Vector3D 結構乘以指定的純量,並傳回結果做為 Vector3DMultiplies the specified Vector3D structure by the specified scalar and returns the result as a Vector3D.

Multiply(Vector3D, Matrix3D) Multiply(Vector3D, Matrix3D) Multiply(Vector3D, Matrix3D) Multiply(Vector3D, Matrix3D)

使用指定的 Vector3D 結構,轉換指定之 Matrix3D 結構的座標空間。Transforms the coordinate space of the specified Vector3D structure using the specified Matrix3D structure.

Negate() Negate() Negate() Negate()

Vector3D 結構加上負號。Negates a Vector3D structure.

Normalize() Normalize() Normalize() Normalize()

將指定的 Vector3D 結構標準化。Normalizes the specified Vector3D structure.

Parse(String) Parse(String) Parse(String) Parse(String)

3-D3-D 向量的 String 表示轉換成對等的 Vector3D 結構。Converts a String representation of a 3-D3-D vector into the equivalent Vector3D structure.

Subtract(Vector3D, Point3D) Subtract(Vector3D, Point3D) Subtract(Vector3D, Point3D) Subtract(Vector3D, Point3D)

Point3D 結構減去 Vector3D 結構。Subtracts a Point3D structure from a Vector3D structure.

Subtract(Vector3D, Vector3D) Subtract(Vector3D, Vector3D) Subtract(Vector3D, Vector3D) Subtract(Vector3D, Vector3D)

Vector3D 結構減去 Vector3D 結構。Subtracts a Vector3D structure from a Vector3D structure.

ToString() ToString() ToString() ToString()

建立這個 String 結構的 Vector3D 表示。Creates a String representation of this Vector3D structure.

ToString(IFormatProvider) ToString(IFormatProvider) ToString(IFormatProvider) ToString(IFormatProvider)

建立這個 String 結構的 Vector3D 表示。Creates a String representation of this Vector3D structure.

運算子

Addition(Vector3D, Vector3D) Addition(Vector3D, Vector3D) Addition(Vector3D, Vector3D) Addition(Vector3D, Vector3D)

將兩個 Vector3D 結構相加,並傳回結果做為 Vector3D 結構。Adds two Vector3D structures and returns the result as a Vector3D structure.

Addition(Vector3D, Point3D) Addition(Vector3D, Point3D) Addition(Vector3D, Point3D) Addition(Vector3D, Point3D)

依指定的 Point3D 結構平移指定的 Vector3D 結構,並傳回結果做為 Point3D 結構。Translates the specified Point3D structure by the specified Vector3D structure and returns the result as a Point3D structure.

Division(Vector3D, Double) Division(Vector3D, Double) Division(Vector3D, Double) Division(Vector3D, Double)

將指定的 Vector3D 結構除以指定的純量,並傳回結果做為 Vector3DDivides the specified Vector3D structure by the specified scalar and returns the result as a Vector3D.

Equality(Vector3D, Vector3D) Equality(Vector3D, Vector3D) Equality(Vector3D, Vector3D) Equality(Vector3D, Vector3D)

比較兩個 Vector3D 結構是否相等。Compares two Vector3D structures for equality.

Explicit(Vector3D to Point3D) Explicit(Vector3D to Point3D) Explicit(Vector3D to Point3D) Explicit(Vector3D to Point3D)

Vector3D 結構轉換成 Point3D 結構。Converts a Vector3D structure into a Point3D structure.

Explicit(Vector3D to Size3D) Explicit(Vector3D to Size3D) Explicit(Vector3D to Size3D) Explicit(Vector3D to Size3D)

Vector3D 結構轉換為 Size3DConverts a Vector3D structure into a Size3D.

Inequality(Vector3D, Vector3D) Inequality(Vector3D, Vector3D) Inequality(Vector3D, Vector3D) Inequality(Vector3D, Vector3D)

比較兩個 Vector3D 結構是否相等。Compares two Vector3D structures for inequality.

Multiply(Vector3D, Matrix3D) Multiply(Vector3D, Matrix3D) Multiply(Vector3D, Matrix3D) Multiply(Vector3D, Matrix3D)

使用指定的 Vector3D 結構,轉換指定之 Matrix3D 結構的座標空間。Transforms the coordinate space of the specified Vector3D structure using the specified Matrix3D structure.

Multiply(Double, Vector3D) Multiply(Double, Vector3D) Multiply(Double, Vector3D) Multiply(Double, Vector3D)

將指定的純量乘以指定的 Vector3D 結構,並傳回結果做為 Vector3DMultiplies the specified scalar by the specified Vector3D structure and returns the result as a Vector3D.

Multiply(Vector3D, Double) Multiply(Vector3D, Double) Multiply(Vector3D, Double) Multiply(Vector3D, Double)

將指定的 Vector3D 結構乘以指定的純量,並傳回結果做為 Vector3DMultiplies the specified Vector3D structure by the specified scalar and returns the result as a Vector3D.

Subtraction(Vector3D, Vector3D) Subtraction(Vector3D, Vector3D) Subtraction(Vector3D, Vector3D) Subtraction(Vector3D, Vector3D)

Vector3D 結構減去 Vector3D 結構。Subtracts a Vector3D structure from a Vector3D structure.

Subtraction(Vector3D, Point3D) Subtraction(Vector3D, Point3D) Subtraction(Vector3D, Point3D) Subtraction(Vector3D, Point3D)

Point3D 結構減去 Vector3D 結構。Subtracts a Point3D structure from a Vector3D structure.

UnaryNegation(Vector3D) UnaryNegation(Vector3D) UnaryNegation(Vector3D) UnaryNegation(Vector3D)

Vector3D 結構加上負號。Negates a Vector3D structure.

明確介面實作

IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider)

這個成員是 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基礎結構的一部分,但不建議程式碼直接使用。This member is part of the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly by your code. 如需這個成員的說明,請參閱 ToString(String, IFormatProvider)For a description of this member, see ToString(String, IFormatProvider).

適用於