C# Class Microsoft.Xna.Framework.Vector2

ファイルを表示 Open project: DeathCradle/Open-Terraria-API Class Usage Examples

Public Properties

Property Type Description
Array Vector2[]
X float
Y float

Public Methods

Method Description
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.

Method Details

Add() public static method

Adds two vectors.
public static Add ( Vector2 value1, Vector2 value2 ) : Vector2
value1 Vector2 Source vector.
value2 Vector2 Source vector.
return Vector2

Add() public static method

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.
return void

Barycentric() public static method

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).
return Vector2

Barycentric() public static method

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.
return void

CatmullRom() public static method

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.
return Vector2

CatmullRom() public static method

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.
return void

Clamp() public static method

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.
return Vector2

Clamp() public static method

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.
return void

Distance() public static method

Calculates the distance between two vectors.
public static Distance ( Vector2 value1, Vector2 value2 ) : float
value1 Vector2 Source vector.
value2 Vector2 Source vector.
return float

Distance() public static method

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.
return void

DistanceSquared() public static method

Calculates the distance between two vectors squared.
public static DistanceSquared ( Vector2 value1, Vector2 value2 ) : float
value1 Vector2 Source vector.
value2 Vector2 Source vector.
return float

DistanceSquared() public static method

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.
return void

Divide() public static method

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.
return Vector2

Divide() public static method

Divides a vector by a scalar value.
public static Divide ( Vector2 value1, float divider ) : Vector2
value1 Vector2 Source vector.
divider float The divisor.
return Vector2

Divide() public static method

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.
return void

Divide() public static method

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.
return void

Dot() public static method

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.
return float

Dot() public static method

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.
return void

Equals() public method

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.
return bool

Equals() public method

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.
return bool

GetHashCode() public method

Gets the hash code of the vector object.
public GetHashCode ( ) : int
return int

Hermite() public static method

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.
return Vector2

Hermite() public static method

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.
return void

Length() public method

Calculates the length of the vector.
public Length ( ) : float
return float

LengthSquared() public method

Calculates the length of the vector squared.
public LengthSquared ( ) : float
return float

Lerp() public static method

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.
return Vector2

Lerp() public static method

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.
return void

Max() public static method

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.
return Vector2

Max() public static method

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.
return void

Min() public static method

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.
return Vector2

Min() public static method

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.
return void

Multiply() public static method

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.
return Vector2

Multiply() public static method

Multiplies a vector by a scalar value.
public static Multiply ( Vector2 value1, float scaleFactor ) : Vector2
value1 Vector2 Source vector.
scaleFactor float Scalar value.
return Vector2

Multiply() public static method

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.
return void

Multiply() public static method

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.
return void

Negate() public static method

Returns a vector pointing in the opposite direction.
public static Negate ( Vector2 value ) : Vector2
value Vector2 Source vector.
return Vector2

Negate() public static method

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.
return void

Normalize() public static method

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.
return Vector2

Normalize() public method

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
return void

Normalize() public static method

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.
return void

Reflect() public static method

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.
return Vector2

Reflect() public static method

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.
return void

SmoothStep() public static method

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.
return Vector2

SmoothStep() public static method

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.
return void

Subtract() public static method

Subtracts a vector from a vector.
public static Subtract ( Vector2 value1, Vector2 value2 ) : Vector2
value1 Vector2 Source vector.
value2 Vector2 Source vector.
return Vector2

Subtract() public static method

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.
return void

ToString() public method

Retrieves a string representation of the current object.
public ToString ( ) : string
return string

Transform() public static method

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.
return Vector2

Vector2() public method

Creates a new instance of Vector2.
public Vector2 ( float value ) : System
value float Value to initialize both components to.
return System

Vector2() public method

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.
return System

operator() public static method

Returns a vector pointing in the opposite direction.
public static operator ( ) : Vector2
return Vector2

operator() public static method

Tests vectors for equality.
public static operator ( ) : bool
return bool

Property Details

Array public_oe static_oe property

public static Vector2[] Array
return Vector2[]

X public_oe property

Gets or sets the x-component of the vector.
public float X
return float

Y public_oe property

Gets or sets the y-component of the vector.
public float Y
return float