Vector 構造体
定義
2-D 空間における変位を表します。Represents a displacement in 2-D space.
public value class Vector : IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.VectorConverter))]
public struct Vector : IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.VectorConverter))]
[System.Serializable]
public struct Vector : IFormattable
[<System.ComponentModel.TypeConverter(typeof(System.Windows.VectorConverter))>]
type Vector = struct
interface IFormattable
[<System.ComponentModel.TypeConverter(typeof(System.Windows.VectorConverter))>]
[<System.Serializable>]
type Vector = struct
interface IFormattable
Public Structure Vector
Implements IFormattable
- 継承
- 属性
- 実装
例
2つの構造体を追加する方法を次の例に示し Vector ます。The following example shows how to add two Vector structures.
// Adds a Vector to a Vector using the overloaded + operator.
Vector vector1 = new Vector(20, 30);
Vector vector2 = new Vector(45, 70);
Vector vectorResult = new Vector();
// vectorResult is equal to (65,100)
vectorResult = vector1 + vector2;
' Adds a Vector to a Vector using the overloaded + operator.
Dim vector1 As New Vector(20, 30)
Dim vector2 As New Vector(45, 70)
Dim vectorResult As New Vector()
' vectorResult is equal to (65,100)
vectorResult = vector1 + vector2
注釈
は Point 固定位置を表しますが、は Vector 方向と大きさ (たとえば、ベロシティや加速度) を表します。A Point represents a fixed position, but a Vector represents a direction and a magnitude (for example, velocity or acceleration). したがって、直線セグメントのエンドポイントはポイントですが、その差はベクターです。つまり、その線分の方向と長さです。Thus, the endpoints of a line segment are points but their difference is a vector; that is, the direction and length of that line segment.
XAML では、の値との値の間の区切り記号には、 X Y Vector コンマまたはスペースを使用できます。In XAML, the delimiter between the X and Y values of a Vector can be either a comma or a space.
カルチャによっては、ピリオド文字の代わりにコンマ文字が小数点の区切り記号として使用される場合があります。Some cultures might use the comma character as the decimal delimiter instead of the period character. インバリアントカルチャの XAML 処理は、ほとんどの XAML プロセッサ実装では en-us に既定で設定されており、ピリオドは小数点の区切り記号になります。XAML processing for invariant culture defaults to en-US in most XAML processor implementations, and expects the period to be the decimal delimiter. XAML でを指定する場合、小数点区切り文字としてコンマ文字を使用しないようにする必要があり Vector ます。これは、 Vector 属性値からコンポーネントおよびコンポーネントへの文字列型の変換と競合するため X Y です。You should avoid using the comma character as the decimal delimiter if specifying a Vector in XAML, because that will clash with the string type conversion of a Vector attribute value into the X and Y components.
XAML 属性の使用方法XAML Attribute Usage
<object property="x,y"/>
-or-
<object property="x y"/>
XAML 値XAML Values
xx
ベクターの X コンポーネント。The vector's X component. 詳細については、X プロパティを参照してください。For more information, see the X property.
yy
ベクターの Y コンポーネント。The vector's Y component. 詳細については、Y プロパティを参照してください。For more information, see the Y property.
コンストラクター
Vector(Double, Double) |
Vector 構造体の新しいインスタンスを初期化します。Initializes a new instance of the Vector structure. |
プロパティ
Length |
このベクターの長さを取得します。Gets the length of this vector. |
LengthSquared |
このベクターの長さの四角形を取得します。Gets the square of the length of this vector. |
X |
このベクターの X コンポーネントを取得または設定します。Gets or sets the X component of this vector. |
Y |
このベクターの Y コンポーネントを取得または設定します。Gets or sets the Y component of this vector. |
メソッド
Add(Vector, Point) |
指定したポイントを指定したベクターで変換し、その結果のポイントを返します。Translates the specified point by the specified vector and returns the resulting point. |
Add(Vector, Vector) |
2 つのベクターを加算し、その結果を Vector 構造体として返します。Adds two vectors and returns the result as a Vector structure. |
AngleBetween(Vector, Vector) |
2 つの指定したベクターの間の角度 (度単位) を取得します。Retrieves the angle, expressed in degrees, between the two specified vectors. |
CrossProduct(Vector, Vector) |
2 つのベクターのクロス積を計算します。Calculates the cross product of two vectors. |
Determinant(Vector, Vector) |
2 つのベクターの行列式を計算します。Calculates the determinant of two vectors. |
Divide(Vector, Double) |
指定したベクターを指定したスカラーで除算し、その結果を Vector として返します。Divides the specified vector by the specified scalar and returns the result as a Vector. |
Equals(Object) |
指定した Object が Vector 構造体であるかどうか、および、そうである場合には、その構造体がこのベクターと同じ X および Y の値を持つかどうかを判断します。Determines whether the specified Object is a Vector structure and, if it is, whether it has the same X and Y values as this vector. |
Equals(Vector) |
2 つのベクターを比較し、相互に等価かどうかを判断します。Compares two vectors for equality. |
Equals(Vector, Vector) |
指定した 2 つのベクターを比較して、値が等しいかどうかを判断します。Compares the two specified vectors for equality. |
GetHashCode() |
このベクターのハッシュ コードを返します。Returns the hash code for this vector. |
Multiply(Double, Vector) |
指定したスカラーと指定したベクターを乗算し、その結果の Vector を返します。Multiplies the specified scalar by the specified vector and returns the resulting Vector. |
Multiply(Vector, Double) |
指定したベクターと指定したスカラーを乗算し、その結果の Vector を返します。Multiplies 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) |
2 つの指定したベクターのドット積を計算し、その結果を Double として返します。Calculates the dot product of the two specified vectors and returns the result as a Double. |
Negate() |
このベクターを否定します。Negates this vector. ベクターの大きさはこれまでと変わりませんが、方向は逆になります。The vector has the same magnitude as before, but its direction is now opposite. |
Normalize() |
このベクターを正規化します。Normalizes this vector. |
Parse(String) |
ベクターの文字列表現を、等価の Vector 構造体に変換します。Converts a string representation of a vector into the equivalent Vector structure. |
Subtract(Vector, Vector) |
指定したベクターから、指定したもう 1 つのベクターを減算します。Subtracts the specified vector from another specified vector. |
ToString() |
この Vector 構造体の文字列形式を返します。Returns the string representation of this Vector structure. |
ToString(IFormatProvider) |
指定した書式設定情報を使用して、この Vector 構造体の文字列表現を返します。Returns the string representation of this Vector structure with the specified formatting information. |
演算子
Addition(Vector, Point) |
指定したベクターでポイントを変換し、その結果のポイントを返します。Translates a point by the specified vector and returns the resulting point. |
Addition(Vector, Vector) |
2 つのベクターを加算し、その結果をベクターとして返します。Adds two vectors and returns the result as a vector. |
Division(Vector, Double) |
指定したベクターを指定したスカラーで除算し、その結果のベクターを返します。Divides the specified vector by the specified scalar and returns the resulting vector. |
Equality(Vector, Vector) |
2 つのベクターを比較し、相互に等価かどうかを判断します。Compares two vectors for equality. |
Explicit(Vector to Point) |
このベクターの Point および X の値を持つ Y を作成します。Creates a Point with the X and Y values of this vector. |
Explicit(Vector to Size) |
このベクターのオフセットから Size を作成します。Creates a Size from the offsets of this vector. |
Inequality(Vector, Vector) |
2 つのベクターを比較して、等しくないかどうかを判断します。Compares two vectors for inequality. |
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) |
指定したベクターの座標空間を、指定した Matrix を使用して変換します。Transforms the coordinate space of the specified vector using the specified Matrix. |
Multiply(Vector, Vector) |
2 つの指定したベクター構造体のドット積を計算し、その結果を Double として返します。Calculates the dot product of the two specified vector structures and returns the result as a Double. |
Subtraction(Vector, Vector) |
指定したベクターから、指定したもう 1 つのベクターを減算します。Subtracts one specified vector from another. |
UnaryNegation(Vector) |
指定したベクトルを符号反転します。Negates the specified vector. |
明示的なインターフェイスの実装
IFormattable.ToString(String, IFormatProvider) |
このメンバーは、Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) インフラストラクチャをサポートしますが、独自に作成したコードから直接使用するためのものではありません。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. このメンバーの詳細については、「ToString(String, IFormatProvider)」をご覧ください。For a description of this member, see ToString(String, IFormatProvider). |