C# Класс Microsoft.Xna.Framework.Vector2

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
Array Vector2[]
X float
Y float

Открытые методы

Метод Описание
Add ( Vector2 value1, Vector2 value2 ) : Vector2

Adds two vectors.

Add ( Vector2 &value1, Vector2 &value2, Vector2 &result ) : void

Adds two vectors.

Barycentric ( Vector2 value1, Vector2 value2, Vector2 value3, float amount1, float amount2 ) : Vector2

Returns a Vector2 containing the 2D Cartesian coordinates of a point specified in barycentric (areal) coordinates relative to a 2D triangle.

Barycentric ( Vector2 &value1, Vector2 &value2, Vector2 &value3, float amount1, float amount2, Vector2 &result ) : void

Returns a Vector2 containing the 2D Cartesian coordinates of a point specified in barycentric (areal) coordinates relative to a 2D triangle.

CatmullRom ( Vector2 value1, Vector2 value2, Vector2 value3, Vector2 value4, float amount ) : Vector2

Performs a Catmull-Rom interpolation using the specified positions.

CatmullRom ( Vector2 &value1, Vector2 &value2, Vector2 &value3, Vector2 &value4, float amount, Vector2 &result ) : void

Performs a Catmull-Rom interpolation using the specified positions.

Clamp ( Vector2 value1, Vector2 min, Vector2 max ) : Vector2

Restricts a value to be within a specified range.

Clamp ( Vector2 &value1, Vector2 &min, Vector2 &max, Vector2 &result ) : void

Restricts a value to be within a specified range.

Distance ( Vector2 value1, Vector2 value2 ) : float

Calculates the distance between two vectors.

Distance ( Vector2 &value1, Vector2 &value2, float &result ) : void

Calculates the distance between two vectors.

DistanceSquared ( Vector2 value1, Vector2 value2 ) : float

Calculates the distance between two vectors squared.

DistanceSquared ( Vector2 &value1, Vector2 &value2, float &result ) : void

Calculates the distance between two vectors squared.

Divide ( Vector2 value1, Vector2 value2 ) : Vector2

Divides the components of a vector by the components of another vector.

Divide ( Vector2 value1, float divider ) : Vector2

Divides a vector by a scalar value.

Divide ( Vector2 &value1, Vector2 &value2, Vector2 &result ) : void

Divides the components of a vector by the components of another vector.

Divide ( Vector2 &value1, float divider, Vector2 &result ) : void

Divides a vector by a scalar value.

Dot ( Vector2 value1, Vector2 value2 ) : float

Calculates the dot product of two vectors. If the two vectors are unit vectors, the dot product returns a floating point value between -1 and 1 that can be used to determine some properties of the angle between two vectors. For example, it can show whether the vectors are orthogonal, parallel, or have an acute or obtuse angle between them.

Dot ( Vector2 &value1, Vector2 &value2, float &result ) : void

Calculates the dot product of two vectors and writes the result to a user-specified variable. If the two vectors are unit vectors, the dot product returns a floating point value between -1 and 1 that can be used to determine some properties of the angle between two vectors. For example, it can show whether the vectors are orthogonal, parallel, or have an acute or obtuse angle between them.

Equals ( Vector2 other ) : bool

Determines whether the specified Object is equal to the Vector2.

Equals ( object obj ) : bool

Returns a value that indicates whether the current instance is equal to a specified object.

GetHashCode ( ) : int

Gets the hash code of the vector object.

Hermite ( Vector2 value1, Vector2 tangent1, Vector2 value2, Vector2 tangent2, float amount ) : Vector2

Performs a Hermite spline interpolation.

Hermite ( Vector2 &value1, Vector2 &tangent1, Vector2 &value2, Vector2 &tangent2, float amount, Vector2 &result ) : void

Performs a Hermite spline interpolation.

Length ( ) : float

Calculates the length of the vector.

LengthSquared ( ) : float

Calculates the length of the vector squared.

Lerp ( Vector2 value1, Vector2 value2, float amount ) : Vector2

Performs a linear interpolation between two vectors.

Lerp ( Vector2 &value1, Vector2 &value2, float amount, Vector2 &result ) : void

Performs a linear interpolation between two vectors.

Max ( Vector2 value1, Vector2 value2 ) : Vector2

Returns a vector that contains the highest value from each matching pair of components.

Max ( Vector2 &value1, Vector2 &value2, Vector2 &result ) : void

Returns a vector that contains the highest value from each matching pair of components.

Min ( Vector2 value1, Vector2 value2 ) : Vector2

Returns a vector that contains the lowest value from each matching pair of components.

Min ( Vector2 &value1, Vector2 &value2, Vector2 &result ) : void

Returns a vector that contains the lowest value from each matching pair of components.

Multiply ( Vector2 value1, Vector2 value2 ) : Vector2

Multiplies the components of two vectors by each other.

Multiply ( Vector2 value1, float scaleFactor ) : Vector2

Multiplies a vector by a scalar value.

Multiply ( Vector2 &value1, Vector2 &value2, Vector2 &result ) : void

Multiplies the components of two vectors by each other.

Multiply ( Vector2 &value1, float scaleFactor, Vector2 &result ) : void

Multiplies a vector by a scalar value.

Negate ( Vector2 value ) : Vector2

Returns a vector pointing in the opposite direction.

Negate ( Vector2 &value, Vector2 &result ) : void

Returns a vector pointing in the opposite direction.

Normalize ( Vector2 value ) : Vector2

Creates a unit vector from the specified vector. The result is a vector one unit in length pointing in the same direction as the original vector.

Normalize ( ) : void

Turns the current vector into a unit vector. The result is a vector one unit in length pointing in the same direction as the original vector.

Normalize ( Vector2 &value, Vector2 &result ) : void

Creates a unit vector from the specified vector, writing the result to a user-specified variable. The result is a vector one unit in length pointing in the same direction as the original vector.

Reflect ( Vector2 vector, Vector2 normal ) : Vector2

Determines the reflect vector of the given vector and normal.

Reflect ( Vector2 &vector, Vector2 &normal, Vector2 &result ) : void

Determines the reflect vector of the given vector and normal.

SmoothStep ( Vector2 value1, Vector2 value2, float amount ) : Vector2

Interpolates between two values using a cubic equation.

SmoothStep ( Vector2 &value1, Vector2 &value2, float amount, Vector2 &result ) : void

Interpolates between two values using a cubic equation.

Subtract ( Vector2 value1, Vector2 value2 ) : Vector2

Subtracts a vector from a vector.

Subtract ( Vector2 &value1, Vector2 &value2, Vector2 &result ) : void

Subtracts a vector from a vector.

ToString ( ) : string

Retrieves a string representation of the current object.

Transform ( Vector2 position, Matrix matrix ) : Vector2

Transforms the vector (x, y, 0, 1) by the specified matrix.

Transforms a Vector2 by the given Matrix.

Transforms a 2D vector normal by a matrix.

Transforms a vector normal by a matrix.

Transforms a single Vector2, or the vector normal (x, y, 0, 0), by a specified Quaternion rotation.

Transforms a Vector2, or the vector normal (x, y, 0, 0), by a specified Quaternion rotation.

Transforms an array of Vector2s by a specified Matrix.

Transforms a specified range in an array of Vector2s by a specified Matrix and places the results in a specified range in a destination array.

Transforms an array of Vector2 vector normals by a specified Matrix.

Transforms a specified range in an array of Vector2 vector normals by a specified Matrix and places the results in a specified range in a destination array.

Transforms an array of Vector2s by a specified Quaternion.

Transforms a specified range in an array of Vector2s by a specified Quaternion and places the results in a specified range in a destination array.

Vector2 ( float value ) : System

Creates a new instance of Vector2.

Vector2 ( float x, float y ) : System

Initializes a new instance of Vector2.

operator ( ) : Vector2

Returns a vector pointing in the opposite direction.

operator ( ) : bool

Tests vectors for equality.

Описание методов

Add() публичный статический Метод

Adds two vectors.
public static Add ( Vector2 value1, Vector2 value2 ) : Vector2
value1 Vector2 Source vector.
value2 Vector2 Source vector.
Результат Vector2

Add() публичный статический Метод

Adds two vectors.
public static Add ( Vector2 &value1, Vector2 &value2, Vector2 &result ) : void
value1 Vector2 Source vector.
value2 Vector2 Source vector.
result Vector2 [OutAttribute] Sum of the source vectors.
Результат void

Barycentric() публичный статический Метод

Returns a Vector2 containing the 2D Cartesian coordinates of a point specified in barycentric (areal) coordinates relative to a 2D triangle.
public static Barycentric ( Vector2 value1, Vector2 value2, Vector2 value3, float amount1, float amount2 ) : Vector2
value1 Vector2 A Vector2 containing the 2D Cartesian coordinates of vertex 1 of the triangle.
value2 Vector2 A Vector2 containing the 2D Cartesian coordinates of vertex 2 of the triangle.
value3 Vector2 A Vector2 containing the 2D Cartesian coordinates of vertex 3 of the triangle.
amount1 float Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2).
amount2 float Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3).
Результат Vector2

Barycentric() публичный статический Метод

Returns a Vector2 containing the 2D Cartesian coordinates of a point specified in barycentric (areal) coordinates relative to a 2D triangle.
public static Barycentric ( Vector2 &value1, Vector2 &value2, Vector2 &value3, float amount1, float amount2, Vector2 &result ) : void
value1 Vector2 A Vector2 containing the 2D Cartesian coordinates of vertex 1 of the triangle.
value2 Vector2 A Vector2 containing the 2D Cartesian coordinates of vertex 2 of the triangle.
value3 Vector2 A Vector2 containing the 2D Cartesian coordinates of vertex 3 of the triangle.
amount1 float Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2).
amount2 float Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3).
result Vector2 [OutAttribute] The 2D Cartesian coordinates of the specified point are placed in this Vector2 on exit.
Результат void

CatmullRom() публичный статический Метод

Performs a Catmull-Rom interpolation using the specified positions.
public static CatmullRom ( Vector2 value1, Vector2 value2, Vector2 value3, Vector2 value4, float amount ) : Vector2
value1 Vector2 The first position in the interpolation.
value2 Vector2 The second position in the interpolation.
value3 Vector2 The third position in the interpolation.
value4 Vector2 The fourth position in the interpolation.
amount float Weighting factor.
Результат Vector2

CatmullRom() публичный статический Метод

Performs a Catmull-Rom interpolation using the specified positions.
public static CatmullRom ( Vector2 &value1, Vector2 &value2, Vector2 &value3, Vector2 &value4, float amount, Vector2 &result ) : void
value1 Vector2 The first position in the interpolation.
value2 Vector2 The second position in the interpolation.
value3 Vector2 The third position in the interpolation.
value4 Vector2 The fourth position in the interpolation.
amount float Weighting factor.
result Vector2 [OutAttribute] A vector that is the result of the Catmull-Rom interpolation.
Результат void

Clamp() публичный статический Метод

Restricts a value to be within a specified range.
public static Clamp ( Vector2 value1, Vector2 min, Vector2 max ) : Vector2
value1 Vector2 The value to clamp.
min Vector2 The minimum value.
max Vector2 The maximum value.
Результат Vector2

Clamp() публичный статический Метод

Restricts a value to be within a specified range.
public static Clamp ( Vector2 &value1, Vector2 &min, Vector2 &max, Vector2 &result ) : void
value1 Vector2 The value to clamp.
min Vector2 The minimum value.
max Vector2 The maximum value.
result Vector2 [OutAttribute] The clamped value.
Результат void

Distance() публичный статический Метод

Calculates the distance between two vectors.
public static Distance ( Vector2 value1, Vector2 value2 ) : float
value1 Vector2 Source vector.
value2 Vector2 Source vector.
Результат float

Distance() публичный статический Метод

Calculates the distance between two vectors.
public static Distance ( Vector2 &value1, Vector2 &value2, float &result ) : void
value1 Vector2 Source vector.
value2 Vector2 Source vector.
result float [OutAttribute] The distance between the vectors.
Результат void

DistanceSquared() публичный статический Метод

Calculates the distance between two vectors squared.
public static DistanceSquared ( Vector2 value1, Vector2 value2 ) : float
value1 Vector2 Source vector.
value2 Vector2 Source vector.
Результат float

DistanceSquared() публичный статический Метод

Calculates the distance between two vectors squared.
public static DistanceSquared ( Vector2 &value1, Vector2 &value2, float &result ) : void
value1 Vector2 Source vector.
value2 Vector2 Source vector.
result float [OutAttribute] The distance between the vectors squared.
Результат void

Divide() публичный статический Метод

Divides the components of a vector by the components of another vector.
public static Divide ( Vector2 value1, Vector2 value2 ) : Vector2
value1 Vector2 Source vector.
value2 Vector2 Divisor vector.
Результат Vector2

Divide() публичный статический Метод

Divides a vector by a scalar value.
public static Divide ( Vector2 value1, float divider ) : Vector2
value1 Vector2 Source vector.
divider float The divisor.
Результат Vector2

Divide() публичный статический Метод

Divides the components of a vector by the components of another vector.
public static Divide ( Vector2 &value1, Vector2 &value2, Vector2 &result ) : void
value1 Vector2 Source vector.
value2 Vector2 The divisor.
result Vector2 [OutAttribute] The result of the division.
Результат void

Divide() публичный статический Метод

Divides a vector by a scalar value.
public static Divide ( Vector2 &value1, float divider, Vector2 &result ) : void
value1 Vector2 Source vector.
divider float The divisor.
result Vector2 [OutAttribute] The result of the division.
Результат void

Dot() публичный статический Метод

Calculates the dot product of two vectors. If the two vectors are unit vectors, the dot product returns a floating point value between -1 and 1 that can be used to determine some properties of the angle between two vectors. For example, it can show whether the vectors are orthogonal, parallel, or have an acute or obtuse angle between them.
public static Dot ( Vector2 value1, Vector2 value2 ) : float
value1 Vector2 Source vector.
value2 Vector2 Source vector.
Результат float

Dot() публичный статический Метод

Calculates the dot product of two vectors and writes the result to a user-specified variable. If the two vectors are unit vectors, the dot product returns a floating point value between -1 and 1 that can be used to determine some properties of the angle between two vectors. For example, it can show whether the vectors are orthogonal, parallel, or have an acute or obtuse angle between them.
public static Dot ( Vector2 &value1, Vector2 &value2, float &result ) : void
value1 Vector2 Source vector.
value2 Vector2 Source vector.
result float [OutAttribute] The dot product of the two vectors.
Результат void

Equals() публичный Метод

Determines whether the specified Object is equal to the Vector2.
public Equals ( Vector2 other ) : bool
other Vector2 The Object to compare with the current Vector2.
Результат bool

Equals() публичный Метод

Returns a value that indicates whether the current instance is equal to a specified object.
public Equals ( object obj ) : bool
obj object Object to make the comparison with.
Результат bool

GetHashCode() публичный Метод

Gets the hash code of the vector object.
public GetHashCode ( ) : int
Результат int

Hermite() публичный статический Метод

Performs a Hermite spline interpolation.
public static Hermite ( Vector2 value1, Vector2 tangent1, Vector2 value2, Vector2 tangent2, float amount ) : Vector2
value1 Vector2 Source position vector.
tangent1 Vector2 Source tangent vector.
value2 Vector2 Source position vector.
tangent2 Vector2 Source tangent vector.
amount float Weighting factor.
Результат Vector2

Hermite() публичный статический Метод

Performs a Hermite spline interpolation.
public static Hermite ( Vector2 &value1, Vector2 &tangent1, Vector2 &value2, Vector2 &tangent2, float amount, Vector2 &result ) : void
value1 Vector2 Source position vector.
tangent1 Vector2 Source tangent vector.
value2 Vector2 Source position vector.
tangent2 Vector2 Source tangent vector.
amount float Weighting factor.
result Vector2 [OutAttribute] The result of the Hermite spline interpolation.
Результат void

Length() публичный Метод

Calculates the length of the vector.
public Length ( ) : float
Результат float

LengthSquared() публичный Метод

Calculates the length of the vector squared.
public LengthSquared ( ) : float
Результат float

Lerp() публичный статический Метод

Performs a linear interpolation between two vectors.
public static Lerp ( Vector2 value1, Vector2 value2, float amount ) : Vector2
value1 Vector2 Source vector.
value2 Vector2 Source vector.
amount float Value between 0 and 1 indicating the weight of value2.
Результат Vector2

Lerp() публичный статический Метод

Performs a linear interpolation between two vectors.
public static Lerp ( Vector2 &value1, Vector2 &value2, float amount, Vector2 &result ) : void
value1 Vector2 Source vector.
value2 Vector2 Source vector.
amount float Value between 0 and 1 indicating the weight of value2.
result Vector2 [OutAttribute] The result of the interpolation.
Результат void

Max() публичный статический Метод

Returns a vector that contains the highest value from each matching pair of components.
public static Max ( Vector2 value1, Vector2 value2 ) : Vector2
value1 Vector2 Source vector.
value2 Vector2 Source vector.
Результат Vector2

Max() публичный статический Метод

Returns a vector that contains the highest value from each matching pair of components.
public static Max ( Vector2 &value1, Vector2 &value2, Vector2 &result ) : void
value1 Vector2 Source vector.
value2 Vector2 Source vector.
result Vector2 [OutAttribute] The maximized vector.
Результат void

Min() публичный статический Метод

Returns a vector that contains the lowest value from each matching pair of components.
public static Min ( Vector2 value1, Vector2 value2 ) : Vector2
value1 Vector2 Source vector.
value2 Vector2 Source vector.
Результат Vector2

Min() публичный статический Метод

Returns a vector that contains the lowest value from each matching pair of components.
public static Min ( Vector2 &value1, Vector2 &value2, Vector2 &result ) : void
value1 Vector2 Source vector.
value2 Vector2 Source vector.
result Vector2 [OutAttribute] The minimized vector.
Результат void

Multiply() публичный статический Метод

Multiplies the components of two vectors by each other.
public static Multiply ( Vector2 value1, Vector2 value2 ) : Vector2
value1 Vector2 Source vector.
value2 Vector2 Source vector.
Результат Vector2

Multiply() публичный статический Метод

Multiplies a vector by a scalar value.
public static Multiply ( Vector2 value1, float scaleFactor ) : Vector2
value1 Vector2 Source vector.
scaleFactor float Scalar value.
Результат Vector2

Multiply() публичный статический Метод

Multiplies the components of two vectors by each other.
public static Multiply ( Vector2 &value1, Vector2 &value2, Vector2 &result ) : void
value1 Vector2 Source vector.
value2 Vector2 Source vector.
result Vector2 [OutAttribute] The result of the multiplication.
Результат void

Multiply() публичный статический Метод

Multiplies a vector by a scalar value.
public static Multiply ( Vector2 &value1, float scaleFactor, Vector2 &result ) : void
value1 Vector2 Source vector.
scaleFactor float Scalar value.
result Vector2 [OutAttribute] The result of the multiplication.
Результат void

Negate() публичный статический Метод

Returns a vector pointing in the opposite direction.
public static Negate ( Vector2 value ) : Vector2
value Vector2 Source vector.
Результат Vector2

Negate() публичный статический Метод

Returns a vector pointing in the opposite direction.
public static Negate ( Vector2 &value, Vector2 &result ) : void
value Vector2 Source vector.
result Vector2 [OutAttribute] Vector pointing in the opposite direction.
Результат void

Normalize() публичный статический Метод

Creates a unit vector from the specified vector. The result is a vector one unit in length pointing in the same direction as the original vector.
public static Normalize ( Vector2 value ) : Vector2
value Vector2 Source Vector2.
Результат Vector2

Normalize() публичный Метод

Turns the current vector into a unit vector. The result is a vector one unit in length pointing in the same direction as the original vector.
public Normalize ( ) : void
Результат void

Normalize() публичный статический Метод

Creates a unit vector from the specified vector, writing the result to a user-specified variable. The result is a vector one unit in length pointing in the same direction as the original vector.
public static Normalize ( Vector2 &value, Vector2 &result ) : void
value Vector2 Source vector.
result Vector2 [OutAttribute] Normalized vector.
Результат void

Reflect() публичный статический Метод

Determines the reflect vector of the given vector and normal.
public static Reflect ( Vector2 vector, Vector2 normal ) : Vector2
vector Vector2 Source vector.
normal Vector2 Normal of vector.
Результат Vector2

Reflect() публичный статический Метод

Determines the reflect vector of the given vector and normal.
public static Reflect ( Vector2 &vector, Vector2 &normal, Vector2 &result ) : void
vector Vector2 Source vector.
normal Vector2 Normal of vector.
result Vector2 [OutAttribute] The created reflect vector.
Результат void

SmoothStep() публичный статический Метод

Interpolates between two values using a cubic equation.
public static SmoothStep ( Vector2 value1, Vector2 value2, float amount ) : Vector2
value1 Vector2 Source value.
value2 Vector2 Source value.
amount float Weighting value.
Результат Vector2

SmoothStep() публичный статический Метод

Interpolates between two values using a cubic equation.
public static SmoothStep ( Vector2 &value1, Vector2 &value2, float amount, Vector2 &result ) : void
value1 Vector2 Source value.
value2 Vector2 Source value.
amount float Weighting value.
result Vector2 [OutAttribute] The interpolated value.
Результат void

Subtract() публичный статический Метод

Subtracts a vector from a vector.
public static Subtract ( Vector2 value1, Vector2 value2 ) : Vector2
value1 Vector2 Source vector.
value2 Vector2 Source vector.
Результат Vector2

Subtract() публичный статический Метод

Subtracts a vector from a vector.
public static Subtract ( Vector2 &value1, Vector2 &value2, Vector2 &result ) : void
value1 Vector2 Source vector.
value2 Vector2 Source vector.
result Vector2 [OutAttribute] The result of the subtraction.
Результат void

ToString() публичный Метод

Retrieves a string representation of the current object.
public ToString ( ) : string
Результат string

Transform() публичный статический Метод

Transforms the vector (x, y, 0, 1) by the specified matrix. Transforms a Vector2 by the given Matrix. Transforms a 2D vector normal by a matrix. Transforms a vector normal by a matrix. Transforms a single Vector2, or the vector normal (x, y, 0, 0), by a specified Quaternion rotation. Transforms a Vector2, or the vector normal (x, y, 0, 0), by a specified Quaternion rotation. Transforms an array of Vector2s by a specified Matrix. Transforms a specified range in an array of Vector2s by a specified Matrix and places the results in a specified range in a destination array. Transforms an array of Vector2 vector normals by a specified Matrix. Transforms a specified range in an array of Vector2 vector normals by a specified Matrix and places the results in a specified range in a destination array. Transforms an array of Vector2s by a specified Quaternion. Transforms a specified range in an array of Vector2s by a specified Quaternion and places the results in a specified range in a destination array.
public static Transform ( Vector2 position, Matrix matrix ) : Vector2
position Vector2 The source vector.
matrix Matrix The transformation matrix.
Результат Vector2

Vector2() публичный Метод

Creates a new instance of Vector2.
public Vector2 ( float value ) : System
value float Value to initialize both components to.
Результат System

Vector2() публичный Метод

Initializes a new instance of Vector2.
public Vector2 ( float x, float y ) : System
x float Initial value for the x-component of the vector.
y float Initial value for the y-component of the vector.
Результат System

operator() публичный статический Метод

Returns a vector pointing in the opposite direction.
public static operator ( ) : Vector2
Результат Vector2

operator() публичный статический Метод

Tests vectors for equality.
public static operator ( ) : bool
Результат bool

Описание свойств

Array публичное статическое свойство

public static Vector2[] Array
Результат Vector2[]

X публичное свойство

Gets or sets the x-component of the vector.
public float X
Результат float

Y публичное свойство

Gets or sets the y-component of the vector.
public float Y
Результат float