Struct Float2
2D vector with float data values
Implements
Constructors
Float2(float, float)
2D vector with float data values
Declaration
public Float2(float x, float y)
Fields
Down
Declaration
public static readonly Float2 Down
Left
Declaration
public static readonly Float2 Left
One
Declaration
public static readonly Float2 One
Right
Declaration
public static readonly Float2 Right
Up
Declaration
public static readonly Float2 Up
Zero
Declaration
public static readonly Float2 Zero
x
Declaration
public float x
y
Declaration
public float y
Properties
this[int]
Get float data inside with given index. (0 means x, 1 means y)
Declaration
public float this[int index] { readonly get; set; }
Magnitude
Length of this vector
Declaration
public readonly float Magnitude { get; }
Normalized
Get a vector that has a length of 1, while maintaining the same direction as the original vector.
Declaration
public readonly Float2 Normalized { get; }
SqrMagnitude
Square of the length of this vector
Declaration
public readonly float SqrMagnitude { get; }
Methods
Deconstruct(out float, out float)
Declaration
public readonly void Deconstruct(out float x, out float y)
Distance(Float2, Float2)
Distance between two given position
Declaration
public static float Distance(Float2 a, Float2 b)
Dot(Float2, Float2)
The dot product of two vectors returns a float value representing the cosine of the angle between them
Declaration
public static float Dot(Float2 a, Float2 b)
Equals(Float2)
Indicates whether the current object is equal to another object of the same type.
Declaration
public readonly bool Equals(Float2 other)
Parameters
Type | Name | Description |
---|---|---|
Float2 | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
Equals(object)
Indicates whether this instance and a specified object are equal.
Declaration
public override readonly bool Equals(object other)
Returns
Type | Description |
---|---|
bool | true if |
Overrides
GetHashCode()
Returns the hash code for this instance.
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
Lerp(Float2, Float2, float)
Find a value transform between two given float smoothly
Declaration
public static Float2 Lerp(Float2 a, Float2 b, float t)
Representation of the position. 0 means value A, 1 means value B.
LerpUnclamped(Float2, Float2, float)
Find a value transform between two given float smoothly without limit the t value
Declaration
public static Float2 LerpUnclamped(Float2 a, Float2 b, float t)
Representation of the position. 0 means value A, 1 means value B.
MoveTowards(Float2, Float2, float)
Moves a point towards the target with distance limitation
Declaration
public static Float2 MoveTowards(Float2 current, Float2 target, float maxDistanceDelta)
Parameters
Type | Name | Description |
---|---|---|
Float2 | current | Starting position |
Float2 | target | Target end position |
float | maxDistanceDelta | Distance limit |
Returns
Type | Description |
---|---|
Float2 | The new position |
Normalize()
Make the vector have length of 1 while maintaining the same direction as original.
Declaration
public void Normalize()
Set(float, float)
Set both values of this vector
Declaration
public void Set(float newX, float newY)
SignedAngle(Float2, Float2)
Signed angle in degrees between from and to
Declaration
public static float SignedAngle(Float2 from, Float2 to)
ToString()
Returns the fully qualified type name of this instance.
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
string | The fully qualified type name. |
Overrides
Operators
operator +(Float2, Float2)
Declaration
public static Float2 operator +(Float2 a, Float2 b)
operator /(Float2, Float2)
Declaration
public static Float2 operator /(Float2 a, Float2 b)
operator /(Float2, float)
Declaration
public static Float2 operator /(Float2 a, float d)
operator ==(Float2, Float2)
Declaration
public static bool operator ==(Float2 lhs, Float2 rhs)
explicit operator Float2(Float3)
Declaration
public static explicit operator Float2(Float3 v)
implicit operator Float3(Float2)
Declaration
public static implicit operator Float3(Float2 v)
operator !=(Float2, Float2)
Declaration
public static bool operator !=(Float2 lhs, Float2 rhs)
operator *(Float2, Float2)
Declaration
public static Float2 operator *(Float2 a, Float2 b)
operator *(Float2, float)
Declaration
public static Float2 operator *(Float2 a, float d)
operator *(float, Float2)
Declaration
public static Float2 operator *(float d, Float2 a)
operator -(Float2, Float2)
Declaration
public static Float2 operator -(Float2 a, Float2 b)
operator -(Float2)
Declaration
public static Float2 operator -(Float2 a)