Class Float2
Represents a two dimensional mathematical vector.
Inheritance
Implements
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public sealed class Float2 : ValueType, IEquatable<Float2>, IFormattable
Constructors
Float2(Double2)
Initializes a new instance of the Float2 struct.
Declaration
public Float2(Double2 value)
Parameters
Double2
value
A vector containing the values with which to initialize the X, Y and Z components. 
Float2(Float3)
Initializes a new instance of the Float2 struct.
Declaration
public Float2(Float3 value)
Parameters
Float3
value
A vector containing the values with which to initialize the X and Y components. 
Float2(Float4)
Initializes a new instance of the Float2 struct.
Declaration
public Float2(Float4 value)
Parameters
Float4
value
A vector containing the values with which to initialize the X and Y components. 
Float2(Vector2)
Initializes a new instance of the Float2 struct.
Declaration
public Float2(Vector2 value)
Parameters
Vector2
value
A vector containing the values with which to initialize the X, Y and Z components. 
Float2(Single)
Initializes a new instance of the Float2 struct.
Declaration
public Float2(float value)
Parameters
System.Single
value
The value that will be assigned to all components. 
Float2(Single, Single)
Initializes a new instance of the Float2 struct.
Declaration
public Float2(float x, float y)
Parameters
System.Single
x
Initial value for the X component of the vector. 
System.Single
y
Initial value for the Y component of the vector. 
Float2(Single[])
Initializes a new instance of the Float2 struct.
Declaration
public Float2(float[] values)
Parameters
System.Single[]
values
The values to assign to the X and Y components of the vector. This must be an array with two elements. 
Exceptions
System.ArgumentNullException
Thrown when 
System.ArgumentOutOfRangeException
Thrown when 
Fields
Half
A Float2 with all of its components set to half.
Declaration
public static readonly Float2 Half
Field Value
Float2

Maximum
A Float2 with all components equal to System.Single.MaxValue.
Declaration
public static readonly Float2 Maximum
Field Value
Float2

Minimum
A Float2 with all components equal to System.Single.MinValue.
Declaration
public static readonly Float2 Minimum
Field Value
Float2

One
A Float2 with all of its components set to one.
Declaration
public static readonly Float2 One
Field Value
Float2

SizeInBytes
The size of the Float2 type, in bytes.
Declaration
public static readonly int SizeInBytes
Field Value
System.Int32

UnitX
UnitY
X
The X component of the vector.
Declaration
public float X
Field Value
System.Single

Y
The Y component of the vector.
Declaration
public float Y
Field Value
System.Single

Zero
A Float2 with all of its components set to zero.
Declaration
public static readonly Float2 Zero
Field Value
Float2

Properties
Absolute
Gets a vector with values being absolute values of that vector.
Declaration
public Float2 Absolute { get; }
Property Value
Float2

AvgValue
Gets an arithmetic average value of all vector components.
Declaration
public float AvgValue { get; }
Property Value
System.Single

Default
IsNormalized
Gets a value indicting whether this instance is normalized.
Declaration
public bool IsNormalized { get; }
Property Value
System.Boolean

IsZero
Gets a value indicting whether this vector is zero
Declaration
public bool IsZero { get; }
Property Value
System.Boolean

Item[Int32]
Gets or sets the component at the specified index.
Declaration
public float this[int index] { get; set; }
Parameters
System.Int32
index
The index of the component to access. Use 0 for the X component and 1 for the Y component. 
Property Value
System.Single
The value of the X or Y component, depending on the index. 
Exceptions
System.ArgumentOutOfRangeException
Thrown when the 
Length
Calculates the length of the vector.
Declaration
public float Length { get; }
Property Value
System.Single
The length of the vector. 
Remarks
LengthSquared may be preferred when only the relative length is needed and speed is of the essence.
LengthSquared
Calculates the squared length of the vector.
Declaration
public float LengthSquared { get; }
Property Value
System.Single
The squared length of the vector. 
Remarks
This method may be preferred to Length when only a relative length is needed and speed is of the essence.
MaxValue
Gets a maximum component value
Declaration
public float MaxValue { get; }
Property Value
System.Single

MinValue
Gets a minimum component value
Declaration
public float MinValue { get; }
Property Value
System.Single

Negative
Gets a vector with values being opposite to values of that vector.
Declaration
public Float2 Negative { get; }
Property Value
Float2

Normalized
Gets the normalized vector. Returned vector has length equal 1.
Declaration
public Float2 Normalized { get; }
Property Value
Float2

ValuesSum
Gets a sum of the component values.
Declaration
public float ValuesSum { get; }
Property Value
System.Single

Methods
Abs(Float2)
Returns the absolute value of a vector.
Declaration
public static Float2 Abs(Float2 v)
Parameters
Float2
v
The value. 
Returns
Float2
A vector which components are less or equal to 0. 
Add(Float2, Float2)
Adds two vectors.
Declaration
public static Float2 Add(Float2 left, Float2 right)
Parameters
Float2
left
The first vector to add. 
Float2
right
The second vector to add. 
Returns
Float2
The sum of the two vectors. 
Add(Float2, Single)
Performs a componentwise addition.
Declaration
public static Float2 Add(Float2 left, float right)
Parameters
Float2
left
The input vector 
System.Single
right
The scalar value to be added to elements 
Returns
Float2
The vector with added scalar for each element. 
Add(ref Float2, ref Float2, out Float2)
Adds two vectors.
Declaration
public static void Add(ref Float2 left, ref Float2 right, out Float2 result)
Parameters
Float2
left
The first vector to add. 
Float2
right
The second vector to add. 
Float2
result
When the method completes, contains the sum of the two vectors. 
Add(ref Float2, ref Single, out Float2)
Performs a componentwise addition.
Declaration
public static void Add(ref Float2 left, ref float right, out Float2 result)
Parameters
Float2
left
The input vector 
System.Single
right
The scalar value to be added to elements 
Float2
result
The vector with added scalar for each element. 
Barycentric(Float2, Float2, Float2, Single, Single)
Returns a Float2 containing the 2D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 2D triangle.
Declaration
public static Float2 Barycentric(Float2 value1, Float2 value2, Float2 value3, float amount1, float amount2)
Parameters
Float2
value1
A Float2 containing the 2D Cartesian coordinates of vertex 1 of the triangle. 
Float2
value2
A Float2 containing the 2D Cartesian coordinates of vertex 2 of the triangle. 
Float2
value3
A Float2 containing the 2D Cartesian coordinates of vertex 3 of the triangle. 
System.Single
amount1
Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in 
System.Single
amount2
Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in 
Returns
Float2
A new Float2 containing the 2D Cartesian coordinates of the specified point. 
Barycentric(ref Float2, ref Float2, ref Float2, Single, Single, out Float2)
Returns a Float2 containing the 2D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 2D triangle.
Declaration
public static void Barycentric(ref Float2 value1, ref Float2 value2, ref Float2 value3, float amount1, float amount2, out Float2 result)
Parameters
Float2
value1
A Float2 containing the 2D Cartesian coordinates of vertex 1 of the triangle. 
Float2
value2
A Float2 containing the 2D Cartesian coordinates of vertex 2 of the triangle. 
Float2
value3
A Float2 containing the 2D Cartesian coordinates of vertex 3 of the triangle. 
System.Single
amount1
Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in 
System.Single
amount2
Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in 
Float2
result
When the method completes, contains the 2D Cartesian coordinates of the specified point. 
CatmullRom(Float2, Float2, Float2, Float2, Single)
Performs a CatmullRom interpolation using the specified positions.
Declaration
public static Float2 CatmullRom(Float2 value1, Float2 value2, Float2 value3, Float2 value4, float amount)
Parameters
Float2
value1
The first position in the interpolation. 
Float2
value2
The second position in the interpolation. 
Float2
value3
The third position in the interpolation. 
Float2
value4
The fourth position in the interpolation. 
System.Single
amount
Weighting factor. 
Returns
Float2
A vector that is the result of the CatmullRom interpolation. 
CatmullRom(ref Float2, ref Float2, ref Float2, ref Float2, Single, out Float2)
Performs a CatmullRom interpolation using the specified positions.
Declaration
public static void CatmullRom(ref Float2 value1, ref Float2 value2, ref Float2 value3, ref Float2 value4, float amount, out Float2 result)
Parameters
Float2
value1
The first position in the interpolation. 
Float2
value2
The second position in the interpolation. 
Float2
value3
The third position in the interpolation. 
Float2
value4
The fourth position in the interpolation. 
System.Single
amount
Weighting factor. 
Float2
result
When the method completes, contains the result of the CatmullRom interpolation. 
Ceil(Float2)
Returns the vector with components containing the smallest integer greater to or equal to the original value.
Declaration
public static Float2 Ceil(Float2 v)
Parameters
Float2
v
The value. 
Returns
Float2
The result. 
Clamp(Float2, Float2, Float2)
Restricts a value to be within a specified range.
Declaration
public static Float2 Clamp(Float2 value, Float2 min, Float2 max)
Parameters
Float2
value
The value to clamp. 
Float2
min
The minimum value. 
Float2
max
The maximum value. 
Returns
Float2
The clamped value. 
Clamp(ref Float2, ref Float2, ref Float2, out Float2)
Restricts a value to be within a specified range.
Declaration
public static void Clamp(ref Float2 value, ref Float2 min, ref Float2 max, out Float2 result)
Parameters
Float2
value
The value to clamp. 
Float2
min
The minimum value. 
Float2
max
The maximum value. 
Float2
result
When the method completes, contains the clamped value. 
ClampLength(Float2, Single)
Makes sure that Length of the output vector is always below max and above 0.
Declaration
public static Float2 ClampLength(Float2 vector, float max)
Parameters
Float2
vector
Input vector. 
System.Single
max
Max Length 
Returns
Float2

ClampLength(Float2, Single, Single)
Makes sure that Length of the output vector is always below max and above min.
Declaration
public static Float2 ClampLength(Float2 vector, float min, float max)
Parameters
Float2
vector
Input vector. 
System.Single
min
Min Length 
System.Single
max
Max Length 
Returns
Float2

ClampLength(Float2, Single, Single, out Float2)
Makes sure that Length of the output vector is always below max and above min.
Declaration
public static void ClampLength(Float2 vector, float min, float max, out Float2 result)
Parameters
Float2
vector
Input vector. 
System.Single
min
Min Length 
System.Single
max
Max Length 
Float2
result
The result value. 
Cross(Float2, Float2)
Calculates the cross product of two vectors.
Declaration
public static float Cross(Float2 left, Float2 right)
Parameters
Float2
left
First source vector. 
Float2
right
Second source vector. 
Returns
System.Single
The cross product of the two vectors. 
Cross(ref Float2, ref Float2)
Calculates the cross product of two vectors.
Declaration
public static float Cross(ref Float2 left, ref Float2 right)
Parameters
Float2
left
First source vector. 
Float2
right
Second source vector. 
Returns
System.Single
The cross product of the two vectors. 
Cross(ref Float2, ref Float2, out Single)
Calculates the cross product of two vectors.
Declaration
public static void Cross(ref Float2 left, ref Float2 right, out float result)
Parameters
Float2
left
First source vector. 
Float2
right
Second source vector. 
System.Single
result
When the method completes, contains the cross product of the two vectors. 
Distance(Float2, Float2)
Calculates the distance between two vectors.
Declaration
public static float Distance(Float2 value1, Float2 value2)
Parameters
Float2
value1
The first vector. 
Float2
value2
The second vector. 
Returns
System.Single
The distance between the two vectors. 
Remarks
DistanceSquared(Float2, Float2) may be preferred when only the relative distance is needed and speed is of the essence.
Distance(ref Float2, ref Float2)
Calculates the distance between two vectors.
Declaration
public static float Distance(ref Float2 value1, ref Float2 value2)
Parameters
Float2
value1
The first vector. 
Float2
value2
The second vector. 
Returns
System.Single
The distance between the two vectors. 
Remarks
DistanceSquared(ref Float2, ref Float2, out Single) may be preferred when only the relative distance is needed and speed is of the essence.
Distance(ref Float2, ref Float2, out Single)
Calculates the distance between two vectors.
Declaration
public static void Distance(ref Float2 value1, ref Float2 value2, out float result)
Parameters
Float2
value1
The first vector. 
Float2
value2
The second vector. 
System.Single
result
When the method completes, contains the distance between the two vectors. 
Remarks
DistanceSquared(ref Float2, ref Float2, out Single) may be preferred when only the relative distance is needed and speed is of the essence.
DistanceSquared(Float2, Float2)
Calculates the squared distance between two vectors.
Declaration
public static float DistanceSquared(Float2 value1, Float2 value2)
Parameters
Float2
value1
The first vector. 
Float2
value2
The second vector. 
Returns
System.Single
The squared distance between the two vectors. 
DistanceSquared(ref Float2, ref Float2)
Calculates the squared distance between two vectors.
Declaration
public static float DistanceSquared(ref Float2 value1, ref Float2 value2)
Parameters
Float2
value1
The first vector. 
Float2
value2
The second vector 
Returns
System.Single
The squared distance between the two vectors. 
DistanceSquared(ref Float2, ref Float2, out Single)
Calculates the squared distance between two vectors.
Declaration
public static void DistanceSquared(ref Float2 value1, ref Float2 value2, out float result)
Parameters
Float2
value1
The first vector. 
Float2
value2
The second vector 
System.Single
result
When the method completes, contains the squared distance between the two vectors. 
Divide(Float2, Single)
Scales a vector by the given value.
Declaration
public static Float2 Divide(Float2 value, float scale)
Parameters
Float2
value
The vector to scale. 
System.Single
scale
The amount by which to scale the vector. 
Returns
Float2
The scaled vector. 
Divide(ref Float2, Single, out Float2)
Scales a vector by the given value.
Declaration
public static void Divide(ref Float2 value, float scale, out Float2 result)
Parameters
Float2
value
The vector to scale. 
System.Single
scale
The amount by which to scale the vector. 
Float2
result
When the method completes, contains the scaled vector. 
Divide(Single, Float2)
Scales a vector by the given value.
Declaration
public static Float2 Divide(float scale, Float2 value)
Parameters
System.Single
scale
The amount by which to scale the vector. 
Float2
value
The vector to scale. 
Returns
Float2
The scaled vector. 
Divide(Single, ref Float2, out Float2)
Scales a vector by the given value.
Declaration
public static void Divide(float scale, ref Float2 value, out Float2 result)
Parameters
System.Single
scale
The amount by which to scale the vector. 
Float2
value
The vector to scale. 
Float2
result
When the method completes, contains the scaled vector. 
Dot(Float2, Float2)
Calculates the dot product of two vectors.
Declaration
public static float Dot(Float2 left, Float2 right)
Parameters
Float2
left
First source vector. 
Float2
right
Second source vector. 
Returns
System.Single
The dot product of the two vectors. 
Dot(ref Float2, ref Float2)
Calculates the dot product of two vectors.
Declaration
public static float Dot(ref Float2 left, ref Float2 right)
Parameters
Float2
left
First source vector. 
Float2
right
Second source vector. 
Returns
System.Single
The dot product of the two vectors. 
Dot(ref Float2, ref Float2, out Single)
Calculates the dot product of two vectors.
Declaration
public static void Dot(ref Float2 left, ref Float2 right, out float result)
Parameters
Float2
left
First source vector. 
Float2
right
Second source vector. 
System.Single
result
When the method completes, contains the dot product of the two vectors. 
Equals(Float2)
Determines whether the specified Float2 is equal to this instance.
Declaration
public bool Equals(Float2 other)
Parameters
Float2
other
The Float2 to compare with this instance. 
Returns
System.Boolean

Equals(ref Float2)
Determines whether the specified Float2 is equal to this instance.
Declaration
public bool Equals(ref Float2 other)
Parameters
Float2
other
The Float2 to compare with this instance. 
Returns
System.Boolean

Equals(ref Float2, ref Float2)
Determines whether the specified Float2 are equal.
Declaration
public static bool Equals(ref Float2 a, ref Float2 b)
Parameters
Float2
a

Float2
b

Returns
System.Boolean

Equals(Object)
Determines whether the specified System.Object is equal to this instance.
Declaration
public override bool Equals(object value)
Parameters
System.Object
value
The System.Object to compare with this instance. 
Returns
System.Boolean

GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
System.Int32

Hermite(Float2, Float2, Float2, Float2, Single)
Performs a Hermite spline interpolation.
Declaration
public static Float2 Hermite(Float2 value1, Float2 tangent1, Float2 value2, Float2 tangent2, float amount)
Parameters
Float2
value1
First source position vector. 
Float2
tangent1
First source tangent vector. 
Float2
value2
Second source position vector. 
Float2
tangent2
Second source tangent vector. 
System.Single
amount
Weighting factor. 
Returns
Float2
The result of the Hermite spline interpolation. 
Hermite(ref Float2, ref Float2, ref Float2, ref Float2, Single, out Float2)
Performs a Hermite spline interpolation.
Declaration
public static void Hermite(ref Float2 value1, ref Float2 tangent1, ref Float2 value2, ref Float2 tangent2, float amount, out Float2 result)
Parameters
Float2
value1
First source position vector. 
Float2
tangent1
First source tangent vector. 
Float2
value2
Second source position vector. 
Float2
tangent2
Second source tangent vector. 
System.Single
amount
Weighting factor. 
Float2
result
When the method completes, contains the result of the Hermite spline interpolation. 
Lerp(Float2, Float2, Float2)
Performs a linear interpolation between two vectors.
Declaration
public static Float2 Lerp(Float2 start, Float2 end, Float2 amount)
Parameters
Float2
start
Start vector. 
Float2
end
End vector. 
Float2
amount
Value between 0 and 1 indicating the weight of 
Returns
Float2
The linear interpolation of the two vectors. 
Remarks
Passing amount
a value of 0 will cause start
to be returned; a value of 1 will cause end
to be returned.
Lerp(Float2, Float2, Single)
Performs a linear interpolation between two vectors.
Declaration
public static Float2 Lerp(Float2 start, Float2 end, float amount)
Parameters
Float2
start
Start vector. 
Float2
end
End vector. 
System.Single
amount
Value between 0 and 1 indicating the weight of 
Returns
Float2
The linear interpolation of the two vectors. 
Remarks
Passing amount
a value of 0 will cause start
to be returned; a value of 1 will cause end
to be returned.
Lerp(ref Float2, ref Float2, ref Float2, out Float2)
Performs a linear interpolation between two vectors.
Declaration
public static void Lerp(ref Float2 start, ref Float2 end, ref Float2 amount, out Float2 result)
Parameters
Float2
start
Start vector. 
Float2
end
End vector. 
Float2
amount
Value between 0 and 1 indicating the weight of 
Float2
result
When the method completes, contains the linear interpolation of the two vectors. 
Remarks
Passing amount
a value of 0 will cause start
to be returned; a value of 1 will cause end
to be returned.
Lerp(ref Float2, ref Float2, Single, out Float2)
Performs a linear interpolation between two vectors.
Declaration
public static void Lerp(ref Float2 start, ref Float2 end, float amount, out Float2 result)
Parameters
Float2
start
Start vector. 
Float2
end
End vector. 
System.Single
amount
Value between 0 and 1 indicating the weight of 
Float2
result
When the method completes, contains the linear interpolation of the two vectors. 
Remarks
Passing amount
a value of 0 will cause start
to be returned; a value of 1 will cause end
to be returned.
Max(Float2, Float2)
Returns a vector containing the largest components of the specified vectors.
Declaration
public static Float2 Max(Float2 left, Float2 right)
Parameters
Float2
left
The first source vector. 
Float2
right
The second source vector. 
Returns
Float2
A vector containing the largest components of the source vectors. 
Max(ref Float2, ref Float2, out Float2)
Returns a vector containing the largest components of the specified vectors.
Declaration
public static void Max(ref Float2 left, ref Float2 right, out Float2 result)
Parameters
Float2
left
The first source vector. 
Float2
right
The second source vector. 
Float2
result
When the method completes, contains an new vector composed of the largest components of the source vectors. 
Min(Float2, Float2)
Returns a vector containing the smallest components of the specified vectors.
Declaration
public static Float2 Min(Float2 left, Float2 right)
Parameters
Float2
left
The first source vector. 
Float2
right
The second source vector. 
Returns
Float2
A vector containing the smallest components of the source vectors. 
Min(ref Float2, ref Float2, out Float2)
Returns a vector containing the smallest components of the specified vectors.
Declaration
public static void Min(ref Float2 left, ref Float2 right, out Float2 result)
Parameters
Float2
left
The first source vector. 
Float2
right
The second source vector. 
Float2
result
When the method completes, contains an new vector composed of the smallest components of the source vectors. 
Mod(Float2)
Breaks the components of the vector into an integral and a fractional part. Returns vector made of fractional parts.
Declaration
public static Float2 Mod(Float2 v)
Parameters
Float2
v
The value. 
Returns
Float2
The result. 
Multiply(Float2, Float2)
Multiplies a vector with another by performing componentwise multiplication.
Declaration
public static Float2 Multiply(Float2 left, Float2 right)
Parameters
Float2
left
The first vector to multiply. 
Float2
right
The second vector to multiply. 
Returns
Float2
The multiplied vector. 
Multiply(Float2, Single)
Scales a vector by the given value.
Declaration
public static Float2 Multiply(Float2 value, float scale)
Parameters
Float2
value
The vector to scale. 
System.Single
scale
The amount by which to scale the vector. 
Returns
Float2
The scaled vector. 
Multiply(ref Float2, ref Float2, out Float2)
Multiplies a vector with another by performing componentwise multiplication.
Declaration
public static void Multiply(ref Float2 left, ref Float2 right, out Float2 result)
Parameters
Float2
left
The first vector to multiply. 
Float2
right
The second vector to multiply. 
Float2
result
When the method completes, contains the multiplied vector. 
Multiply(ref Float2, Single, out Float2)
Scales a vector by the given value.
Declaration
public static void Multiply(ref Float2 value, float scale, out Float2 result)
Parameters
Float2
value
The vector to scale. 
System.Single
scale
The amount by which to scale the vector. 
Float2
result
When the method completes, contains the scaled vector. 
NearEqual(Float2, Float2, Single)
Tests whether one vector is near another vector.
Declaration
public static bool NearEqual(Float2 left, Float2 right, float epsilon = 1E06F)
Parameters
Float2
left
The left vector. 
Float2
right
The right vector. 
System.Single
epsilon
The epsilon. 
Returns
System.Boolean

NearEqual(ref Float2, ref Float2, Single)
Tests whether one vector is near another vector.
Declaration
public static bool NearEqual(ref Float2 left, ref Float2 right, float epsilon = 1E06F)
Parameters
Float2
left
The left vector. 
Float2
right
The right vector. 
System.Single
epsilon
The epsilon. 
Returns
System.Boolean

Negate(Float2)
Reverses the direction of a given vector.
Declaration
public static Float2 Negate(Float2 value)
Parameters
Float2
value
The vector to negate. 
Returns
Float2
A vector facing in the opposite direction. 
Negate(ref Float2, out Float2)
Reverses the direction of a given vector.
Declaration
public static void Negate(ref Float2 value, out Float2 result)
Parameters
Float2
value
The vector to negate. 
Float2
result
When the method completes, contains a vector facing in the opposite direction. 
Normalize()
Converts the vector into a unit vector.
Declaration
public void Normalize()
Normalize(Float2)
Converts the vector into a unit vector.
Declaration
public static Float2 Normalize(Float2 value)
Parameters
Float2
value
The vector to normalize. 
Returns
Float2
The normalized vector. 
Normalize(ref Float2, out Float2)
Converts the vector into a unit vector.
Declaration
public static void Normalize(ref Float2 value, out Float2 result)
Parameters
Float2
value
The vector to normalize. 
Float2
result
When the method completes, contains the normalized vector. 
Perpendicular(Float2)
Calculates the 2D vector perpendicular to the given 2D vector. The result is always rotated 90degrees in a counterclockwise direction for a 2D coordinate system where the positive Y axis goes up.
Declaration
public static Float2 Perpendicular(Float2 inDirection)
Parameters
Float2
inDirection
The input direction. 
Returns
Float2
The result. 
Perpendicular(ref Float2, out Float2)
Calculates the 2D vector perpendicular to the given 2D vector. The result is always rotated 90degrees in a counterclockwise direction for a 2D coordinate system where the positive Y axis goes up.
Declaration
public static void Perpendicular(ref Float2 inDirection, out Float2 result)
Parameters
Float2
inDirection
The in direction. 
Float2
result
When the method completes, contains the result of the calculation. 
Reflect(Float2, Float2)
Returns the reflection of a vector off a surface that has the specified normal.
Declaration
public static Float2 Reflect(Float2 vector, Float2 normal)
Parameters
Float2
vector
The source vector. 
Float2
normal
Normal of the surface. 
Returns
Float2
The reflected vector. 
Remarks
Reflect only gives the direction of a reflection off a surface, it does not determine whether the original vector was close enough to the surface to hit it.
Reflect(ref Float2, ref Float2, out Float2)
Returns the reflection of a vector off a surface that has the specified normal.
Declaration
public static void Reflect(ref Float2 vector, ref Float2 normal, out Float2 result)
Parameters
Float2
vector
The source vector. 
Float2
normal
Normal of the surface. 
Float2
result
When the method completes, contains the reflected vector. 
Remarks
Reflect only gives the direction of a reflection off a surface, it does not determine whether the original vector was close enough to the surface to hit it.
Round(Float2)
Returns the vector with components rounded to the nearest integer.
Declaration
public static Float2 Round(Float2 v)
Parameters
Float2
v
The value. 
Returns
Float2
The result. 
Saturate()
Saturates this instance in the range [0,1].
Declaration
public void Saturate()
SmoothStep(Float2, Float2, Single)
Performs a cubic interpolation between two vectors.
Declaration
public static Float2 SmoothStep(Float2 start, Float2 end, float amount)
Parameters
Float2
start
Start vector. 
Float2
end
End vector. 
System.Single
amount
Value between 0 and 1 indicating the weight of 
Returns
Float2
The cubic interpolation of the two vectors. 
SmoothStep(ref Float2, ref Float2, Single, out Float2)
Performs a cubic interpolation between two vectors.
Declaration
public static void SmoothStep(ref Float2 start, ref Float2 end, float amount, out Float2 result)
Parameters
Float2
start
Start vector. 
Float2
end
End vector. 
System.Single
amount
Value between 0 and 1 indicating the weight of 
Float2
result
When the method completes, contains the cubic interpolation of the two vectors. 
Subtract(Float2, Float2)
Subtracts two vectors.
Declaration
public static Float2 Subtract(Float2 left, Float2 right)
Parameters
Float2
left
The first vector to subtract. 
Float2
right
The second vector to subtract. 
Returns
Float2
The difference of the two vectors. 
Subtract(Float2, Single)
Performs a componentwise subtraction.
Declaration
public static Float2 Subtract(Float2 left, float right)
Parameters
Float2
left
The input vector 
System.Single
right
The scalar value to be subtracted from elements 
Returns
Float2
The vector with subtracted scalar for each element. 
Subtract(ref Float2, ref Float2, out Float2)
Subtracts two vectors.
Declaration
public static void Subtract(ref Float2 left, ref Float2 right, out Float2 result)
Parameters
Float2
left
The first vector to subtract. 
Float2
right
The second vector to subtract. 
Float2
result
When the method completes, contains the difference of the two vectors. 
Subtract(ref Float2, ref Single, out Float2)
Performs a componentwise subtraction.
Declaration
public static void Subtract(ref Float2 left, ref float right, out Float2 result)
Parameters
Float2
left
The input vector 
System.Single
right
The scalar value to be subtracted from elements 
Float2
result
The vector with subtracted scalar for each element. 
Subtract(Single, Float2)
Performs a componentwise subtraction.
Declaration
public static Float2 Subtract(float left, Float2 right)
Parameters
System.Single
left
The scalar value to be subtracted from elements 
Float2
right
The input vector 
Returns
Float2
The vector with subtracted scalar for each element. 
Subtract(ref Single, ref Float2, out Float2)
Performs a componentwise subtraction.
Declaration
public static void Subtract(ref float left, ref Float2 right, out Float2 result)
Parameters
System.Single
left
The scalar value to be subtracted from elements 
Float2
right
The input vector 
Float2
result
The vector with subtracted scalar for each element. 
ToArray()
Creates an array containing the elements of the vector.
Declaration
public float[] ToArray()
Returns
System.Single[]

ToString()
Returns a System.String that represents this instance.
Declaration
public override string ToString()
Returns
System.String
A System.String that represents this instance. 
ToString(IFormatProvider)
Returns a System.String that represents this instance.
Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
System.IFormatProvider
formatProvider
The format provider. 
Returns
System.String
A System.String that represents this instance. 
ToString(String)
Returns a System.String that represents this instance.
Declaration
public string ToString(string format)
Parameters
System.String
format
The format. 
Returns
System.String
A System.String that represents this instance. 
ToString(String, IFormatProvider)
Returns a System.String that represents this instance.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
System.String
format
The format. 
System.IFormatProvider
formatProvider
The format provider. 
Returns
System.String
A System.String that represents this instance. 
Transform(Float2, Matrix)
Transforms a 2D vector by the given Matrix.
Declaration
public static Float4 Transform(Float2 vector, Matrix transform)
Parameters
Float2
vector
The source vector. 
Matrix
transform
The transformation Matrix. 
Returns
Float4
The transformed Float4. 
Transform(Float2, Quaternion)
Transforms a 2D vector by the given Quaternion rotation.
Declaration
public static Float2 Transform(Float2 vector, Quaternion rotation)
Parameters
Float2
vector
The vector to rotate. 
Quaternion
rotation
The Quaternion rotation to apply. 
Returns
Float2
The transformed Float2. 
Transform(ref Float2, ref Matrix, out Float4)
Transforms a 2D vector by the given Matrix.
Declaration
public static void Transform(ref Float2 vector, ref Matrix transform, out Float4 result)
Parameters
Float2
vector
The source vector. 
Matrix
transform
The transformation Matrix. 
Float4
result
When the method completes, contains the transformed Float4. 
Transform(ref Float2, ref Quaternion, out Float2)
Transforms a 2D vector by the given Quaternion rotation.
Declaration
public static void Transform(ref Float2 vector, ref Quaternion rotation, out Float2 result)
Parameters
Float2
vector
The vector to rotate. 
Quaternion
rotation
The Quaternion rotation to apply. 
Float2
result
When the method completes, contains the transformed Float2. 
TransformCoordinate(Float2, Matrix)
Performs a coordinate transformation using the given Matrix.
Declaration
public static Float2 TransformCoordinate(Float2 coordinate, Matrix transform)
Parameters
Float2
coordinate
The coordinate vector to transform. 
Matrix
transform
The transformation Matrix. 
Returns
Float2
The transformed coordinates. 
Remarks
A coordinate transform performs the transformation with the assumption that the w component is one. The four dimensional vector obtained from the transformation operation has each component in the vector divided by the w component. This forces the w component to be one and therefore makes the vector homogeneous. The homogeneous vector is often preferred when working with coordinates as the w component can safely be ignored.
TransformCoordinate(ref Float2, ref Matrix, out Float2)
Performs a coordinate transformation using the given Matrix.
Declaration
public static void TransformCoordinate(ref Float2 coordinate, ref Matrix transform, out Float2 result)
Parameters
Float2
coordinate
The coordinate vector to transform. 
Matrix
transform
The transformation Matrix. 
Float2
result
When the method completes, contains the transformed coordinates. 
Remarks
A coordinate transform performs the transformation with the assumption that the w component is one. The four dimensional vector obtained from the transformation operation has each component in the vector divided by the w component. This forces the w component to be one and therefore makes the vector homogeneous. The homogeneous vector is often preferred when working with coordinates as the w component can safely be ignored.
TransformNormal(Float2, Matrix)
Performs a normal transformation using the given Matrix.
Declaration
public static Float2 TransformNormal(Float2 normal, Matrix transform)
Parameters
Float2
normal
The normal vector to transform. 
Matrix
transform
The transformation Matrix. 
Returns
Float2
The transformed normal. 
Remarks
A normal transform performs the transformation with the assumption that the w component is zero. This causes the fourth row and fourth column of the matrix to be unused. The end result is a vector that is not translated, but all other transformation properties apply. This is often preferred for normal vectors as normals purely represent direction rather than location because normal vectors should not be translated.
TransformNormal(ref Float2, ref Matrix, out Float2)
Performs a normal transformation using the given Matrix.
Declaration
public static void TransformNormal(ref Float2 normal, ref Matrix transform, out Float2 result)
Parameters
Float2
normal
The normal vector to transform. 
Matrix
transform
The transformation Matrix. 
Float2
result
When the method completes, contains the transformed normal. 
Remarks
A normal transform performs the transformation with the assumption that the w component is zero. This causes the fourth row and fourth column of the matrix to be unused. The end result is a vector that is not translated, but all other transformation properties apply. This is often preferred for normal vectors as normals purely represent direction rather than location because normal vectors should not be translated.
TriangleArea(ref Float2, ref Float2, ref Float2)
Calculates the area of the triangle.
Declaration
public static float TriangleArea(ref Float2 v0, ref Float2 v1, ref Float2 v2)
Parameters
Float2
v0
The first triangle vertex. 
Float2
v1
The second triangle vertex. 
Float2
v2
The third triangle vertex. 
Returns
System.Single
The triangle area. 
Operators
Addition(Float2, Float2)
Adds two vectors.
Declaration
public static Float2 operator +(Float2 left, Float2 right)
Parameters
Float2
left
The first vector to add. 
Float2
right
The second vector to add. 
Returns
Float2
The sum of the two vectors. 
Addition(Float2, Single)
Performs a componentwise addition.
Declaration
public static Float2 operator +(Float2 value, float scalar)
Parameters
Float2
value
The input vector. 
System.Single
scalar
The scalar value to be added on elements 
Returns
Float2
The vector with added scalar for each element. 
Addition(Single, Float2)
Performs a componentwise addition.
Declaration
public static Float2 operator +(float scalar, Float2 value)
Parameters
System.Single
scalar
The scalar value to be added on elements 
Float2
value
The input vector. 
Returns
Float2
The vector with added scalar for each element. 
Division(Float2, Float2)
Scales a vector by the given value.
Declaration
public static Float2 operator /(Float2 value, Float2 scale)
Parameters
Float2
value
The vector to scale. 
Float2
scale
The amount by which to scale the vector. 
Returns
Float2
The scaled vector. 
Division(Float2, Double)
Scales a vector by the given value.
Declaration
public static Float2 operator /(Float2 value, double scale)
Parameters
Float2
value
The vector to scale. 
System.Double
scale
The amount by which to scale the vector. 
Returns
Float2
The scaled vector. 
Division(Float2, Single)
Scales a vector by the given value.
Declaration
public static Float2 operator /(Float2 value, float scale)
Parameters
Float2
value
The vector to scale. 
System.Single
scale
The amount by which to scale the vector. 
Returns
Float2
The scaled vector. 
Division(Double, Float2)
Scales a vector by the given value.
Declaration
public static Float2 operator /(double scale, Float2 value)
Parameters
System.Double
scale
The amount by which to scale the vector. 
Float2
value
The vector to scale. 
Returns
Float2
The scaled vector. 
Division(Single, Float2)
Scales a vector by the given value.
Declaration
public static Float2 operator /(float scale, Float2 value)
Parameters
System.Single
scale
The amount by which to scale the vector. 
Float2
value
The vector to scale. 
Returns
Float2
The scaled vector. 
Equality(Float2, Float2)
Tests for equality between two objects.
Declaration
public static bool operator ==(Float2 left, Float2 right)
Parameters
Float2
left
The first value to compare. 
Float2
right
The second value to compare. 
Returns
System.Boolean

Explicit(Float2 to Float3)
Declaration
public static explicit operator Float3(Float2 value)
Parameters
Float2
value
The value. 
Returns
Float3
The result of the conversion. 
Explicit(Float2 to Float4)
Declaration
public static explicit operator Float4(Float2 value)
Parameters
Float2
value
The value. 
Returns
Float4
The result of the conversion. 
Implicit(Float2 to Double2)
Declaration
public static implicit operator Double2(Float2 value)
Parameters
Float2
value
The value. 
Returns
Double2
The result of the conversion. 
Implicit(Float2 to Vector2)
Declaration
public static implicit operator Vector2(Float2 value)
Parameters
Float2
value
The value. 
Returns
Vector2
The result of the conversion. 
Inequality(Float2, Float2)
Tests for inequality between two objects.
Declaration
public static bool operator !=(Float2 left, Float2 right)
Parameters
Float2
left
The first value to compare. 
Float2
right
The second value to compare. 
Returns
System.Boolean

Modulus(Float2, Float2)
Remainder of value divided by scale.
Declaration
public static Float2 operator %(Float2 value, Float2 scale)
Parameters
Float2
value
The vector to scale. 
Float2
scale
The amount by which to scale the vector. 
Returns
Float2
The remained vector. 
Modulus(Float2, Single)
Remainder of value divided by scale.
Declaration
public static Float2 operator %(Float2 value, float scale)
Parameters
Float2
value
The vector to scale. 
System.Single
scale
The amount by which to scale the vector. 
Returns
Float2
The remained vector. 
Modulus(Single, Float2)
Remainder of value divided by scale.
Declaration
public static Float2 operator %(float value, Float2 scale)
Parameters
System.Single
value
The amount by which to scale the vector. 
Float2
scale
The vector to scale. 
Returns
Float2
The remained vector. 
Multiply(Float2, Float2)
Multiplies a vector with another by performing componentwise multiplication equivalent to Multiply(ref Float2, ref Float2, out Float2).
Declaration
public static Float2 operator *(Float2 left, Float2 right)
Parameters
Float2
left
The first vector to multiply. 
Float2
right
The second vector to multiply. 
Returns
Float2
The multiplication of the two vectors. 
Multiply(Float2, Double)
Scales a vector by the given value.
Declaration
public static Float2 operator *(Float2 value, double scale)
Parameters
Float2
value
The vector to scale. 
System.Double
scale
The amount by which to scale the vector. 
Returns
Float2
The scaled vector. 
Multiply(Float2, Single)
Scales a vector by the given value.
Declaration
public static Float2 operator *(Float2 value, float scale)
Parameters
Float2
value
The vector to scale. 
System.Single
scale
The amount by which to scale the vector. 
Returns
Float2
The scaled vector. 
Multiply(Double, Float2)
Scales a vector by the given value.
Declaration
public static Float2 operator *(double scale, Float2 value)
Parameters
System.Double
scale
The amount by which to scale the vector. 
Float2
value
The vector to scale. 
Returns
Float2
The scaled vector. 
Multiply(Single, Float2)
Scales a vector by the given value.
Declaration
public static Float2 operator *(float scale, Float2 value)
Parameters
System.Single
scale
The amount by which to scale the vector. 
Float2
value
The vector to scale. 
Returns
Float2
The scaled vector. 
Subtraction(Float2, Float2)
Subtracts two vectors.
Declaration
public static Float2 operator (Float2 left, Float2 right)
Parameters
Float2
left
The first vector to subtract. 
Float2
right
The second vector to subtract. 
Returns
Float2
The difference of the two vectors. 
Subtraction(Float2, Single)
Performs a componentwise subtraction.
Declaration
public static Float2 operator (Float2 value, float scalar)
Parameters
Float2
value
The input vector. 
System.Single
scalar
The scalar value to be subtracted from elements 
Returns
Float2
The vector with subtracted scalar from each element. 
Subtraction(Single, Float2)
Performs a componentwise subtraction.
Declaration
public static Float2 operator (float scalar, Float2 value)
Parameters
System.Single
scalar
The scalar value to be subtracted from elements 
Float2
value
The input vector. 
Returns
Float2
The vector with subtracted scalar from each element. 
UnaryNegation(Float2)
Reverses the direction of a given vector.
Declaration
public static Float2 operator (Float2 value)
Parameters
Float2
value
The vector to negate. 
Returns
Float2
A vector facing in the opposite direction. 
UnaryPlus(Float2)
Assert a vector (return it unchanged).
Declaration
public static Float2 operator +(Float2 value)
Parameters
Float2
value
The vector to assert (unchanged). 
Returns
Float2
The asserted (unchanged) vector. 