Struct Vector2Base
Represents a two dimensional mathematical vector.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Core/Math/Vector2.h
Syntax
public struct Vector2Base<T>
Type Parameters
T
|
Constructors
Vector2Base()
Empty constructor.
Declaration
public Vector2Base() = default
Fields
Half
Declaration
public static FLAXENGINE_API Vector2Base<T> Half
Field Value
FLAXENGINE_API Vector2Base<T>
|
Maximum
Declaration
public static FLAXENGINE_API Vector2Base<T> Maximum
Field Value
FLAXENGINE_API Vector2Base<T>
|
Minimum
Declaration
public static FLAXENGINE_API Vector2Base<T> Minimum
Field Value
FLAXENGINE_API Vector2Base<T>
|
One
Declaration
public static FLAXENGINE_API Vector2Base<T> One
Field Value
FLAXENGINE_API Vector2Base<T>
|
Raw
The raw vector values (in XY order).
Declaration
public T Raw[2]
Field Value
T
|
TypeInitializer
Declaration
public static FLAXENGINE_API struct ScriptingTypeInitializer TypeInitializer
Field Value
FLAXENGINE_API struct ScriptingTypeInitializer
|
UnitX
Declaration
public static FLAXENGINE_API Vector2Base<T> UnitX
Field Value
FLAXENGINE_API Vector2Base<T>
|
UnitY
Declaration
public static FLAXENGINE_API Vector2Base<T> UnitY
Field Value
FLAXENGINE_API Vector2Base<T>
|
X
The X component of the vector.
Declaration
public T X
Field Value
T
|
Y
The Y component of the vector.
Declaration
public T Y
Field Value
T
|
Zero
Declaration
public static FLAXENGINE_API Vector2Base<T> Zero
Field Value
FLAXENGINE_API Vector2Base<T>
|
Methods
Abs(const Vector2Base& v)
Declaration
public static Vector2Base Abs(const Vector2Base& v)
Parameters
Vector2Base
v
|
Returns
Vector2Base
|
Add(const Vector2Base& a, const Vector2Base& b, Vector2Base& result)
Declaration
public static void Add(const Vector2Base& a, const Vector2Base& b, Vector2Base& result)
Parameters
Vector2Base
a
|
Vector2Base
b
|
Vector2Base
result
|
Angle(const Vector2Base& from, const Vector2Base& to)
Calculates the angle (in radians) between from and to. This is always the smallest value.
Declaration
public static FLAXENGINE_API T Angle(const Vector2Base& from, const Vector2Base& to)
Parameters
Vector2Base
from
The first vector. |
Vector2Base
to
The second vector. |
Returns
FLAXENGINE_API T
The angle (in radians). |
AverageArithmetic()
Returns the average arithmetic of all the components.
Declaration
public T AverageArithmetic() const
Returns
T
|
Ceil(const Vector2Base& v)
Declaration
public static Vector2Base Ceil(const Vector2Base& v)
Parameters
Vector2Base
v
|
Returns
Vector2Base
|
Clamp(const Vector2Base& v, const Vector2Base& min, const Vector2Base& max)
Declaration
public static Vector2Base Clamp(const Vector2Base& v, const Vector2Base& min, const Vector2Base& max)
Parameters
Vector2Base
v
|
Vector2Base
min
|
Vector2Base
max
|
Returns
Vector2Base
|
Clamp(const Vector2Base& v, const Vector2Base& min, const Vector2Base& max, Vector2Base& result)
Declaration
public static void Clamp(const Vector2Base& v, const Vector2Base& min, const Vector2Base& max, Vector2Base& result)
Parameters
Vector2Base
v
|
Vector2Base
min
|
Vector2Base
max
|
Vector2Base
result
|
Cross(const Vector2Base& a, const Vector2Base& b)
Declaration
public static T Cross(const Vector2Base& a, const Vector2Base& b)
Parameters
Vector2Base
a
|
Vector2Base
b
|
Returns
T
|
Distance(const Vector2Base& a, const Vector2Base& b)
Declaration
public static T Distance(const Vector2Base& a, const Vector2Base& b)
Parameters
Vector2Base
a
|
Vector2Base
b
|
Returns
T
|
DistanceSquared(const Vector2Base& a, const Vector2Base& b)
Declaration
public static T DistanceSquared(const Vector2Base& a, const Vector2Base& b)
Parameters
Vector2Base
a
|
Vector2Base
b
|
Returns
T
|
Divide(const Vector2Base& a, const Vector2Base& b, Vector2Base& result)
Declaration
public static void Divide(const Vector2Base& a, const Vector2Base& b, Vector2Base& result)
Parameters
Vector2Base
a
|
Vector2Base
b
|
Vector2Base
result
|
Dot(const Vector2Base& a, const Vector2Base& b)
Declaration
public static T Dot(const Vector2Base& a, const Vector2Base& b)
Parameters
Vector2Base
a
|
Vector2Base
b
|
Returns
T
|
Floor(const Vector2Base& v)
Declaration
public static Vector2Base Floor(const Vector2Base& v)
Parameters
Vector2Base
v
|
Returns
Vector2Base
|
Frac(const Vector2Base& v)
Declaration
public static Vector2Base Frac(const Vector2Base& v)
Parameters
Vector2Base
v
|
Returns
Vector2Base
|
GetAbsolute()
Calculates a vector with values being absolute values of that vector.
Declaration
public Vector2Base GetAbsolute() const
Returns
Vector2Base
|
GetNegative()
Calculates a vector with values being opposite to values of that vector.
Declaration
public Vector2Base GetNegative() const
Returns
Vector2Base
|
GetNormalized()
Calculates a normalized vector that has length equal to 1.
Declaration
public Vector2Base GetNormalized() const
Returns
Vector2Base
|
InvLength()
Declaration
public T InvLength() const
Returns
T
|
IsAnyZero()
Declaration
public bool IsAnyZero() const
Returns
bool
|
IsInfinity()
Returns true if vector has one or more components equal to +/- infinity.
Declaration
public bool IsInfinity() const
Returns
bool
|
IsNaN()
Returns true if vector has one or more components is not a number (NaN).
Declaration
public bool IsNaN() const
Returns
bool
|
IsNanOrInfinity()
Returns true if vector has one or more components equal to +/- infinity or NaN.
Declaration
public bool IsNanOrInfinity() const
Returns
bool
|
IsNormalized()
Declaration
public bool IsNormalized() const
Returns
bool
|
IsOne()
Declaration
public bool IsOne() const
Returns
bool
|
IsZero()
Declaration
public bool IsZero() const
Returns
bool
|
Length()
Declaration
public T Length() const
Returns
T
|
LengthSquared()
Declaration
public T LengthSquared() const
Returns
T
|
Lerp(const Vector2Base& start, const Vector2Base& end, T amount)
Declaration
public static Vector2Base Lerp(const Vector2Base& start, const Vector2Base& end, T amount)
Parameters
Vector2Base
start
|
Vector2Base
end
|
T
amount
|
Returns
Vector2Base
|
Lerp(const Vector2Base& start, const Vector2Base& end, T amount, Vector2Base& result)
Declaration
public static void Lerp(const Vector2Base& start, const Vector2Base& end, T amount, Vector2Base& result)
Parameters
Vector2Base
start
|
Vector2Base
end
|
T
amount
|
Vector2Base
result
|
Max(const Vector2Base& a, const Vector2Base& b)
Declaration
public static Vector2Base Max(const Vector2Base& a, const Vector2Base& b)
Parameters
Vector2Base
a
|
Vector2Base
b
|
Returns
Vector2Base
|
Max(const Vector2Base& a, const Vector2Base& b, Vector2Base& result)
Declaration
public static void Max(const Vector2Base& a, const Vector2Base& b, Vector2Base& result)
Parameters
Vector2Base
a
|
Vector2Base
b
|
Vector2Base
result
|
MaxValue()
Returns the maximum value of all the components.
Declaration
public T MaxValue() const
Returns
T
|
Min(const Vector2Base& a, const Vector2Base& b)
Declaration
public static Vector2Base Min(const Vector2Base& a, const Vector2Base& b)
Parameters
Vector2Base
a
|
Vector2Base
b
|
Returns
Vector2Base
|
Min(const Vector2Base& a, const Vector2Base& b, Vector2Base& result)
Declaration
public static void Min(const Vector2Base& a, const Vector2Base& b, Vector2Base& result)
Parameters
Vector2Base
a
|
Vector2Base
b
|
Vector2Base
result
|
MinValue()
Returns the minimum value of all the components.
Declaration
public T MinValue() const
Returns
T
|
Mod(const Vector2Base& a, const Vector2Base& b)
Declaration
public static Vector2Base Mod(const Vector2Base& a, const Vector2Base& b)
Parameters
Vector2Base
a
|
Vector2Base
b
|
Returns
Vector2Base
|
Multiply(const Vector2Base& a, const Vector2Base& b, Vector2Base& result)
Declaration
public static void Multiply(const Vector2Base& a, const Vector2Base& b, Vector2Base& result)
Parameters
Vector2Base
a
|
Vector2Base
b
|
Vector2Base
result
|
MulValues()
Gets the multiplication result of all vector components values.
Declaration
public T MulValues() const
Returns
T
|
NearEqual(const Vector2Base& a, const Vector2Base& b)
Declaration
public static bool NearEqual(const Vector2Base& a, const Vector2Base& b)
Parameters
Vector2Base
a
|
Vector2Base
b
|
Returns
bool
|
NearEqual(const Vector2Base& a, const Vector2Base& b, T epsilon)
Declaration
public static bool NearEqual(const Vector2Base& a, const Vector2Base& b, T epsilon)
Parameters
Vector2Base
a
|
Vector2Base
b
|
T
epsilon
|
Returns
bool
|
Normalize()
Performs vector normalization (scales vector up to unit length).
Declaration
public void Normalize()
Normalize(const Vector2Base& v)
Declaration
public static Vector2Base Normalize(const Vector2Base& v)
Parameters
Vector2Base
v
|
Returns
Vector2Base
|
operator!=(const Vector2Base& b)
Declaration
public bool operator!=(const Vector2Base& b) const
Parameters
Vector2Base
b
|
Returns
bool
|
operator-()
operator-(const Vector2Base& b)
Declaration
public Vector2Base operator-(const Vector2Base& b) const
Parameters
Vector2Base
b
|
Returns
Vector2Base
|
operator-(T b)
operator-(typename TOtherFloat<T>::Type a)
Declaration
public Vector2Base operator-(typename TOtherFloat<T>::Type a) const
Parameters
typename TOtherFloat<T>::Type
a
|
Returns
Vector2Base
|
operator*(const Vector2Base& b)
Declaration
public Vector2Base operator*(const Vector2Base& b) const
Parameters
Vector2Base
b
|
Returns
Vector2Base
|
operator*(T b)
operator*(typename TOtherFloat<T>::Type a)
Declaration
public Vector2Base operator*(typename TOtherFloat<T>::Type a) const
Parameters
typename TOtherFloat<T>::Type
a
|
Returns
Vector2Base
|
operator*=(const Vector2Base& b)
Declaration
public Vector2Base operator*=(const Vector2Base& b)
Parameters
Vector2Base
b
|
Returns
Vector2Base
|
operator*=(T b)
operator/(const Vector2Base& b)
Declaration
public Vector2Base operator/(const Vector2Base& b) const
Parameters
Vector2Base
b
|
Returns
Vector2Base
|
operator/(T b)
operator/(typename TOtherFloat<T>::Type a)
Declaration
public Vector2Base operator/(typename TOtherFloat<T>::Type a) const
Parameters
typename TOtherFloat<T>::Type
a
|
Returns
Vector2Base
|
operator/=(const Vector2Base& b)
Declaration
public Vector2Base operator/=(const Vector2Base& b)
Parameters
Vector2Base
b
|
Returns
Vector2Base
|
operator/=(T b)
operator+(const Vector2Base& b)
Declaration
public Vector2Base operator+(const Vector2Base& b) const
Parameters
Vector2Base
b
|
Returns
Vector2Base
|
operator+(T b)
operator+(typename TOtherFloat<T>::Type a)
Declaration
public Vector2Base operator+(typename TOtherFloat<T>::Type a) const
Parameters
typename TOtherFloat<T>::Type
a
|
Returns
Vector2Base
|
operator+=(const Vector2Base& b)
Declaration
public Vector2Base operator+=(const Vector2Base& b)
Parameters
Vector2Base
b
|
Returns
Vector2Base
|
operator+=(T b)
operator<(const Vector2Base& b)
operator<=(const Vector2Base& b)
Declaration
public bool operator<=(const Vector2Base& b) const
Parameters
Vector2Base
b
|
Returns
bool
|
operator-=(const Vector2Base& b)
Declaration
public Vector2Base operator-=(const Vector2Base& b)
Parameters
Vector2Base
b
|
Returns
Vector2Base
|
operator-=(T b)
operator==(const Vector2Base& b)
Declaration
public bool operator==(const Vector2Base& b) const
Parameters
Vector2Base
b
|
Returns
bool
|
operator>(const Vector2Base& b)
operator>=(const Vector2Base& b)
Declaration
public bool operator>=(const Vector2Base& b) const
Parameters
Vector2Base
b
|
Returns
bool
|
Round(const Vector2Base& v)
Declaration
public static Vector2Base Round(const Vector2Base& v)
Parameters
Vector2Base
v
|
Returns
Vector2Base
|
Subtract(const Vector2Base& a, const Vector2Base& b, Vector2Base& result)
Declaration
public static void Subtract(const Vector2Base& a, const Vector2Base& b, Vector2Base& result)
Parameters
Vector2Base
a
|
Vector2Base
b
|
Vector2Base
result
|
SumValues()
Gets the sum of all vector components values.
Declaration
public T SumValues() const
Returns
T
|
ToString()
Declaration
public FLAXENGINE_API String ToString() const
Returns
FLAXENGINE_API String
|
TriangleArea(const Vector2Base& v0, const Vector2Base& v1, const Vector2Base& v2)
Calculates the area of the triangle.
Declaration
public static FLAXENGINE_API T TriangleArea(const Vector2Base& v0, const Vector2Base& v1, const Vector2Base& v2)
Parameters
Vector2Base
v0
The first triangle vertex. |
Vector2Base
v1
The second triangle vertex. |
Vector2Base
v2
The third triangle vertex. |
Returns
FLAXENGINE_API T
The triangle area. |
Vector2Base(const Color& color)
Declaration
public FLAXENGINE_API Vector2Base(const Color& color)
Parameters
Color
color
|
Returns
FLAXENGINE_API
|
Vector2Base(const Double3& xy)
Declaration
public FLAXENGINE_API Vector2Base(const Double3& xy)
Parameters
Double3
xy
|
Returns
FLAXENGINE_API
|
Vector2Base(const Double4& xy)
Declaration
public FLAXENGINE_API Vector2Base(const Double4& xy)
Parameters
Double4
xy
|
Returns
FLAXENGINE_API
|
Vector2Base(const Float3& xy)
Declaration
public FLAXENGINE_API Vector2Base(const Float3& xy)
Parameters
Float3
xy
|
Returns
FLAXENGINE_API
|
Vector2Base(const Float4& xy)
Declaration
public FLAXENGINE_API Vector2Base(const Float4& xy)
Parameters
Float4
xy
|
Returns
FLAXENGINE_API
|
Vector2Base(const Int3& xy)
Declaration
public FLAXENGINE_API Vector2Base(const Int3& xy)
Parameters
Int3
xy
|
Returns
FLAXENGINE_API
|
Vector2Base(const Int4& xy)
Declaration
public FLAXENGINE_API Vector2Base(const Int4& xy)
Parameters
Int4
xy
|
Returns
FLAXENGINE_API
|
Vector2Base(const T* xy)
Declaration
public Vector2Base(const T* xy)
Parameters
T
xy
|
Returns
FORCE_INLINE
|
Vector2Base(const Vector2Base<U>& xy)
Declaration
public Vector2Base(const Vector2Base<U>& xy)
Parameters
Vector2Base<U>
xy
|
Returns
FORCE_INLINE
|
Type Parameters
typename U
|
typename TEnableIf<><>
|
Vector2Base(T x, T y)
Declaration
public Vector2Base(T x, T y)
Parameters
T
x
|
T
y
|
Returns
FORCE_INLINE
|
Vector2Base(T xy)
Declaration
public Vector2Base(T xy)
Parameters
T
xy
|
Returns
FORCE_INLINE
|